PageSourceSearch

https://edtechbooks.org/js/etb-editor/editor.ribbon.js

js edtechbooks.org collected 2026-09-24 08:52:11 UTC 1,417 bytes, 41 lines download raw bytes

1class Ribbon {
2
3    constructor(editor) {
4        this.editor = editor;
5        this.Initialize();
6    }
7
8    async Initialize() {
9        if ($('#editor-ribbon').length == 0) $(await GetTemplate('editor-ribbon')).insertBefore(this.editor.editorWindow);
10        this.element = $('#editor-ribbon')[0];
11        RegisterTooltips(this.element);
12        $(this.element).find('[data-ribbon-action]').on('click', async (event) => {
13            console.log('Trying '+$(event.target).attr('data-ribbon-action'));
14            try {
15                let a = $(event.target).attr('data-ribbon-action');
16                switch (a) {
17                    case 'Undo':
18                    case 'Redo':
19                        this.editor.SetCursorPosition(await this.editor.history[a](this.editor.GetActiveElement()));
20                    break;
21                    default:
22                        this.editor.SetCursorPosition(await this.editor[a](this.editor.GetActiveElement()));
23                    break;
24                }
25                if(a=='Save' || a=='ToggleAutoSave') {
26                    this.editor.tray.Update();
27                } else {
28                    this.editor.tray.contextMenu.Show();
29                    this.editor.SetDirty();
30                }
31            } catch (error) {
32                console.error(error);
33            }
34        });
35    }
36
37    Destroy() {
38        $(this.element).remove();
39    }
40
41}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.