@akilli/editor-src 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abbreviation/Abbreviation.js +32 -0
- package/abbreviation/AbbreviationDialog.js +21 -0
- package/audio/Audio.js +47 -0
- package/audio/AudioDialog.js +18 -0
- package/audio/AudioListener.js +50 -0
- package/base/AlignCommand.js +34 -0
- package/base/AlignableListener.js +45 -0
- package/base/Alignment.js +36 -0
- package/base/BarListener.js +95 -0
- package/base/Base.js +127 -0
- package/base/Command.js +139 -0
- package/base/CommandManager.js +60 -0
- package/base/ContentFilter.js +109 -0
- package/base/DeletableListener.js +36 -0
- package/base/DeleteCommand.js +18 -0
- package/base/Dialog.js +153 -0
- package/base/DialogManager.js +44 -0
- package/base/Dispatcher.js +88 -0
- package/base/Dom.js +790 -0
- package/base/EditableListener.js +82 -0
- package/base/Editor.js +448 -0
- package/base/Filter.js +35 -0
- package/base/FilterManager.js +44 -0
- package/base/FocusableListener.js +22 -0
- package/base/FocusbarListener.js +99 -0
- package/base/FormCreator.js +162 -0
- package/base/FormatbarListener.js +32 -0
- package/base/Key.js +258 -0
- package/base/Listener.js +51 -0
- package/base/NavigableListener.js +81 -0
- package/base/Plugin.js +176 -0
- package/base/PluginManager.js +51 -0
- package/base/SlotableListener.js +40 -0
- package/base/SortCommand.js +30 -0
- package/base/SortableListener.js +135 -0
- package/base/Sorting.js +36 -0
- package/base/Tag.js +113 -0
- package/base/TagGroup.js +183 -0
- package/base/TagListener.js +34 -0
- package/base/TagManager.js +61 -0
- package/base/TagName.js +470 -0
- package/base/ToolbarListener.js +11 -0
- package/base/util.js +59 -0
- package/block/Block.js +51 -0
- package/block/BlockDialog.js +11 -0
- package/block/BlockElement.js +21 -0
- package/block/BlockListener.js +60 -0
- package/blockquote/Blockquote.js +43 -0
- package/blockquote/BlockquoteFilter.js +22 -0
- package/blockquote/BlockquoteListener.js +34 -0
- package/bold/Bold.js +30 -0
- package/break/Break.js +33 -0
- package/break/BreakFilter.js +24 -0
- package/build/BuildEditor.js +97 -0
- package/build/editor.css +548 -0
- package/build/editor.woff2 +0 -0
- package/cite/Cite.js +30 -0
- package/code/Code.js +30 -0
- package/data/Data.js +32 -0
- package/data/DataDialog.js +13 -0
- package/definition/Definition.js +32 -0
- package/definition/DefinitionDialog.js +13 -0
- package/deletion/Deletion.js +30 -0
- package/details/Details.js +63 -0
- package/details/DetailsFilter.js +17 -0
- package/details/DetailsListener.js +102 -0
- package/division/Division.js +53 -0
- package/division/DivisionDialog.js +13 -0
- package/emphasis/Emphasis.js +30 -0
- package/figure/Figure.js +58 -0
- package/figure/FigureFilter.js +14 -0
- package/figure/FigureListener.js +23 -0
- package/heading/Heading.js +38 -0
- package/horizontalrule/HorizontalRule.js +37 -0
- package/i18n/I18n.js +26 -0
- package/i18n/de.js +167 -0
- package/iframe/Iframe.js +49 -0
- package/iframe/IframeDialog.js +20 -0
- package/iframe/IframeListener.js +48 -0
- package/image/Image.js +47 -0
- package/image/ImageDialog.js +23 -0
- package/image/ImageListener.js +47 -0
- package/insertion/Insertion.js +30 -0
- package/italic/Italic.js +30 -0
- package/keyboard/Keyboard.js +30 -0
- package/link/Link.js +34 -0
- package/link/LinkDialog.js +14 -0
- package/link/LinkListener.js +45 -0
- package/list/List.js +40 -0
- package/list/ListListener.js +91 -0
- package/mark/Mark.js +30 -0
- package/orderedlist/OrderedList.js +39 -0
- package/package.json +24 -0
- package/paragraph/Paragraph.js +42 -0
- package/paragraph/ParagraphListener.js +40 -0
- package/preformat/Preformat.js +43 -0
- package/preformat/PreformatFilter.js +22 -0
- package/preformat/PreformatListener.js +34 -0
- package/quote/Quote.js +30 -0
- package/sample/Sample.js +30 -0
- package/section/Section.js +55 -0
- package/section/SectionDialog.js +13 -0
- package/small/Small.js +30 -0
- package/strikethrough/Strikethrough.js +30 -0
- package/strong/Strong.js +30 -0
- package/subheading/Subheading.js +38 -0
- package/subscript/Subscript.js +30 -0
- package/superscript/Superscript.js +30 -0
- package/table/Table.js +113 -0
- package/table/TableCellListener.js +125 -0
- package/table/TableColumnAddCommand.js +19 -0
- package/table/TableColumnListener.js +34 -0
- package/table/TableCommand.js +23 -0
- package/table/TableDialog.js +14 -0
- package/table/TableFilter.js +35 -0
- package/table/TableListener.js +39 -0
- package/table/TableRowAddCommand.js +18 -0
- package/table/TableRowListener.js +34 -0
- package/time/Time.js +32 -0
- package/time/TimeDialog.js +13 -0
- package/underline/Underline.js +30 -0
- package/unorderedlist/UnorderedList.js +39 -0
- package/variable/Variable.js +30 -0
- package/video/Video.js +47 -0
- package/video/VideoDialog.js +20 -0
- package/video/VideoListener.js +48 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Break from '../break/Break.js';
|
|
3
|
+
import ParagraphListener from './ParagraphListener.js';
|
|
4
|
+
import Plugin from '../base/Plugin.js';
|
|
5
|
+
import TagGroup from '../base/TagGroup.js';
|
|
6
|
+
import TagName from '../base/TagName.js';
|
|
7
|
+
|
|
8
|
+
export default class Paragraph extends Plugin {
|
|
9
|
+
/**
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
static get name() {
|
|
13
|
+
return 'paragraph';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @type {Plugin[]}
|
|
18
|
+
*/
|
|
19
|
+
static get dependencies() {
|
|
20
|
+
return [Base, Break];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @return {void}
|
|
25
|
+
*/
|
|
26
|
+
init() {
|
|
27
|
+
this._tag({
|
|
28
|
+
name: TagName.P,
|
|
29
|
+
group: TagGroup.PARAGRAPH,
|
|
30
|
+
children: [TagGroup.BREAK, TagGroup.FORMAT],
|
|
31
|
+
deletable: true,
|
|
32
|
+
editable: true,
|
|
33
|
+
focusable: true,
|
|
34
|
+
navigable: true,
|
|
35
|
+
sortable: true,
|
|
36
|
+
enter: TagName.P,
|
|
37
|
+
});
|
|
38
|
+
new ParagraphListener(this.editor);
|
|
39
|
+
this._command(TagName.P);
|
|
40
|
+
this._toolbar('Paragraph');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Listener from '../base/Listener.js';
|
|
2
|
+
import TagName from '../base/TagName.js';
|
|
3
|
+
|
|
4
|
+
export default class ParagraphListener extends Listener {
|
|
5
|
+
/**
|
|
6
|
+
* @param {Editor} editor
|
|
7
|
+
*/
|
|
8
|
+
constructor(editor) {
|
|
9
|
+
super(editor);
|
|
10
|
+
this.editor.root.addEventListener('sethtml', this);
|
|
11
|
+
this.editor.root.addEventListener('insertp', this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {CustomEvent} event
|
|
16
|
+
* @param {HTMLElement} event.detail.element
|
|
17
|
+
* @return {void}
|
|
18
|
+
*/
|
|
19
|
+
sethtml({ detail: { element } }) {
|
|
20
|
+
Array.from(element.getElementsByTagName(TagName.P)).forEach((item) => item.addEventListener('paste', this));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {CustomEvent} event
|
|
25
|
+
* @param {HTMLParagraphElement} event.detail.element
|
|
26
|
+
* @return {void}
|
|
27
|
+
*/
|
|
28
|
+
insertp({ detail: { element } }) {
|
|
29
|
+
element.addEventListener('paste', this);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {ClipboardEvent} event
|
|
34
|
+
* @param {HTMLParagraphElement} event.target
|
|
35
|
+
* @return {void}
|
|
36
|
+
*/
|
|
37
|
+
paste({ target }) {
|
|
38
|
+
this.editor.dom.window.setTimeout(() => this.editor.filters.filter(target));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Break from '../break/Break.js';
|
|
3
|
+
import Figure from '../figure/Figure.js';
|
|
4
|
+
import Plugin from '../base/Plugin.js';
|
|
5
|
+
import PreformatFilter from './PreformatFilter.js';
|
|
6
|
+
import PreformatListener from './PreformatListener.js';
|
|
7
|
+
import TagGroup from '../base/TagGroup.js';
|
|
8
|
+
import TagName from '../base/TagName.js';
|
|
9
|
+
|
|
10
|
+
export default class Preformat extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
static get name() {
|
|
15
|
+
return 'preformat';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {Plugin[]}
|
|
20
|
+
*/
|
|
21
|
+
static get dependencies() {
|
|
22
|
+
return [Base, Break, Figure];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @return {void}
|
|
27
|
+
*/
|
|
28
|
+
init() {
|
|
29
|
+
this._tag({
|
|
30
|
+
name: TagName.PRE,
|
|
31
|
+
group: TagGroup.PREFORMAT,
|
|
32
|
+
children: [TagGroup.BREAK],
|
|
33
|
+
deletable: true,
|
|
34
|
+
editable: true,
|
|
35
|
+
navigable: true,
|
|
36
|
+
enter: TagName.P,
|
|
37
|
+
});
|
|
38
|
+
new PreformatListener(this.editor);
|
|
39
|
+
this._command(TagName.PRE);
|
|
40
|
+
this._toolbar('Preformatted Text');
|
|
41
|
+
this.editor.filters.add(new PreformatFilter(this.editor));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Filter from '../base/Filter.js';
|
|
2
|
+
import Preformat from './Preformat.js';
|
|
3
|
+
import TagName from '../base/TagName.js';
|
|
4
|
+
|
|
5
|
+
export default class PreformatFilter extends Filter {
|
|
6
|
+
/**
|
|
7
|
+
* @param {HTMLElement} element
|
|
8
|
+
* @return {void}
|
|
9
|
+
*/
|
|
10
|
+
filter(element) {
|
|
11
|
+
if (
|
|
12
|
+
element instanceof HTMLElement &&
|
|
13
|
+
element.localName === TagName.FIGURE &&
|
|
14
|
+
element.classList.contains(Preformat.name) &&
|
|
15
|
+
element.querySelector(':scope > ' + TagName.PRE) &&
|
|
16
|
+
!element.querySelector(':scope > ' + TagName.FIGCAPTION)
|
|
17
|
+
) {
|
|
18
|
+
this.editor.dom.insertBefore(element.querySelector(':scope > ' + TagName.PRE), element);
|
|
19
|
+
element.parentElement.removeChild(element);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Listener from '../base/Listener.js';
|
|
2
|
+
import Preformat from './Preformat.js';
|
|
3
|
+
import TagName from '../base/TagName.js';
|
|
4
|
+
|
|
5
|
+
export default class PreformatListener extends Listener {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Editor} editor
|
|
8
|
+
*/
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
super(editor);
|
|
11
|
+
this.editor.root.addEventListener('insertpre', this);
|
|
12
|
+
this.editor.root.addEventListener('deletepre', this);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {CustomEvent} event
|
|
17
|
+
* @param {HTMLPreElement} event.detail.element
|
|
18
|
+
* @return {void}
|
|
19
|
+
*/
|
|
20
|
+
insertpre({ detail: { element } }) {
|
|
21
|
+
this.editor.dom.wrap(element, TagName.FIGURE, { attributes: { class: Preformat.name } });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {CustomEvent} event
|
|
26
|
+
* @param {HTMLElement} event.detail.target
|
|
27
|
+
* @return {void}
|
|
28
|
+
*/
|
|
29
|
+
deletepre({ detail: { target } }) {
|
|
30
|
+
if (target.localName === TagName.FIGURE && target.classList.contains(Preformat.name)) {
|
|
31
|
+
target.parentElement.removeChild(target);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/quote/Quote.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Quote extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'quote';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.Q, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.Q);
|
|
28
|
+
this._formatbar('Quote', Key.Q);
|
|
29
|
+
}
|
|
30
|
+
}
|
package/sample/Sample.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Sample extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'sample';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.SAMP, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.SAMP);
|
|
28
|
+
this._formatbar('Sample Output', Key.O);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Plugin from '../base/Plugin.js';
|
|
3
|
+
import SectionDialog from './SectionDialog.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Section extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'section';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({
|
|
27
|
+
name: TagName.SECTION,
|
|
28
|
+
group: TagGroup.CONTAINER,
|
|
29
|
+
children: [
|
|
30
|
+
TagGroup.AUDIO,
|
|
31
|
+
TagGroup.FIGURE,
|
|
32
|
+
TagGroup.HEADING,
|
|
33
|
+
TagGroup.IFRAME,
|
|
34
|
+
TagGroup.IMAGE,
|
|
35
|
+
TagGroup.LIST,
|
|
36
|
+
TagGroup.PARAGRAPH,
|
|
37
|
+
TagGroup.PREFORMAT,
|
|
38
|
+
TagGroup.QUOTE,
|
|
39
|
+
TagGroup.RULE,
|
|
40
|
+
TagGroup.TABLE,
|
|
41
|
+
TagGroup.VIDEO,
|
|
42
|
+
],
|
|
43
|
+
attributes: ['class'],
|
|
44
|
+
arbitrary: true,
|
|
45
|
+
deletable: true,
|
|
46
|
+
focusable: true,
|
|
47
|
+
navigable: true,
|
|
48
|
+
slotable: true,
|
|
49
|
+
sortable: true,
|
|
50
|
+
});
|
|
51
|
+
this.editor.dialogs.set(new SectionDialog(this.editor, this.constructor.name));
|
|
52
|
+
this._command(TagName.SECTION);
|
|
53
|
+
this._toolbar('Section');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Dialog from '../base/Dialog.js';
|
|
2
|
+
|
|
3
|
+
export default class SectionDialog extends Dialog {
|
|
4
|
+
/**
|
|
5
|
+
* @protected
|
|
6
|
+
* @return {void}
|
|
7
|
+
*/
|
|
8
|
+
_prepareForm() {
|
|
9
|
+
this.formCreator
|
|
10
|
+
.addLegend(this._('Section'))
|
|
11
|
+
.addTextInput('class', this._('CSS class'), { placeholder: this._('Insert CSS class') });
|
|
12
|
+
}
|
|
13
|
+
}
|
package/small/Small.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Small extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'small';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.SMALL, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.SMALL);
|
|
28
|
+
this._formatbar('small', Key.W);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Strikethrough extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'strikethrough';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.S, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.S);
|
|
28
|
+
this._formatbar('strikethrough', Key.R);
|
|
29
|
+
}
|
|
30
|
+
}
|
package/strong/Strong.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Strong extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'strong';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.STRONG, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.STRONG);
|
|
28
|
+
this._formatbar('strongly emphasized', Key.S);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Plugin from '../base/Plugin.js';
|
|
3
|
+
import TagGroup from '../base/TagGroup.js';
|
|
4
|
+
import TagName from '../base/TagName.js';
|
|
5
|
+
|
|
6
|
+
export default class Subheading extends Plugin {
|
|
7
|
+
/**
|
|
8
|
+
* @type {string}
|
|
9
|
+
*/
|
|
10
|
+
static get name() {
|
|
11
|
+
return 'subheading';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {Plugin[]}
|
|
16
|
+
*/
|
|
17
|
+
static get dependencies() {
|
|
18
|
+
return [Base];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @return {void}
|
|
23
|
+
*/
|
|
24
|
+
init() {
|
|
25
|
+
this._tag({
|
|
26
|
+
name: TagName.H3,
|
|
27
|
+
group: TagGroup.HEADING,
|
|
28
|
+
deletable: true,
|
|
29
|
+
editable: true,
|
|
30
|
+
focusable: true,
|
|
31
|
+
navigable: true,
|
|
32
|
+
sortable: true,
|
|
33
|
+
enter: TagName.P,
|
|
34
|
+
});
|
|
35
|
+
this._command(TagName.H3);
|
|
36
|
+
this._toolbar('Subheading');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Subscript extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'subscript';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.SUB, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.SUB);
|
|
28
|
+
this._formatbar('subscript', Key.X);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Key from '../base/Key.js';
|
|
3
|
+
import Plugin from '../base/Plugin.js';
|
|
4
|
+
import TagGroup from '../base/TagGroup.js';
|
|
5
|
+
import TagName from '../base/TagName.js';
|
|
6
|
+
|
|
7
|
+
export default class Superscript extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'superscript';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {Plugin[]}
|
|
17
|
+
*/
|
|
18
|
+
static get dependencies() {
|
|
19
|
+
return [Base];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
this._tag({ name: TagName.SUP, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.SUP);
|
|
28
|
+
this._formatbar('superscript', Key.Y);
|
|
29
|
+
}
|
|
30
|
+
}
|
package/table/Table.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import Break from '../break/Break.js';
|
|
3
|
+
import Figure from '../figure/Figure.js';
|
|
4
|
+
import Plugin from '../base/Plugin.js';
|
|
5
|
+
import TableCellListener from './TableCellListener.js';
|
|
6
|
+
import TableColumnAddCommand from './TableColumnAddCommand.js';
|
|
7
|
+
import TableColumnListener from './TableColumnListener.js';
|
|
8
|
+
import TableCommand from './TableCommand.js';
|
|
9
|
+
import TableDialog from './TableDialog.js';
|
|
10
|
+
import TableFilter from './TableFilter.js';
|
|
11
|
+
import TableListener from './TableListener.js';
|
|
12
|
+
import TableRowAddCommand from './TableRowAddCommand.js';
|
|
13
|
+
import TableRowListener from './TableRowListener.js';
|
|
14
|
+
import TagGroup from '../base/TagGroup.js';
|
|
15
|
+
import TagName from '../base/TagName.js';
|
|
16
|
+
|
|
17
|
+
export default class Table extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
static get name() {
|
|
22
|
+
return 'table';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @type {Plugin[]}
|
|
27
|
+
*/
|
|
28
|
+
static get dependencies() {
|
|
29
|
+
return [Base, Break, Figure];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @return {void}
|
|
34
|
+
*/
|
|
35
|
+
init() {
|
|
36
|
+
this._tag({
|
|
37
|
+
name: TagName.TABLE,
|
|
38
|
+
group: TagGroup.TABLE,
|
|
39
|
+
children: [TagGroup.TABLESECTION],
|
|
40
|
+
deletable: true,
|
|
41
|
+
navigable: true,
|
|
42
|
+
});
|
|
43
|
+
this._tag({
|
|
44
|
+
name: TagName.COLGROUP,
|
|
45
|
+
group: TagGroup.COLGROUP,
|
|
46
|
+
children: [TagGroup.COL],
|
|
47
|
+
});
|
|
48
|
+
this._tag({
|
|
49
|
+
name: TagName.COL,
|
|
50
|
+
group: TagGroup.COL,
|
|
51
|
+
deletable: true,
|
|
52
|
+
focusable: true,
|
|
53
|
+
navigable: true,
|
|
54
|
+
sortable: true,
|
|
55
|
+
});
|
|
56
|
+
this._tag(this.#section(TagName.THEAD));
|
|
57
|
+
this._tag(this.#section(TagName.TBODY));
|
|
58
|
+
this._tag(this.#section(TagName.TFOOT));
|
|
59
|
+
this._tag({
|
|
60
|
+
name: TagName.TR,
|
|
61
|
+
group: TagGroup.TABLEROW,
|
|
62
|
+
children: [TagGroup.TABLECELL],
|
|
63
|
+
deletable: true,
|
|
64
|
+
focusable: true,
|
|
65
|
+
navigable: true,
|
|
66
|
+
sortable: true,
|
|
67
|
+
});
|
|
68
|
+
this._tag(this.#cell(TagName.TH));
|
|
69
|
+
this._tag(this.#cell(TagName.TD));
|
|
70
|
+
new TableListener(this.editor);
|
|
71
|
+
new TableColumnListener(this.editor);
|
|
72
|
+
new TableRowListener(this.editor);
|
|
73
|
+
new TableCellListener(this.editor);
|
|
74
|
+
this.editor.filters.add(new TableFilter(this.editor));
|
|
75
|
+
this.editor.dialogs.set(new TableDialog(this.editor, this.constructor.name));
|
|
76
|
+
this.editor.commands.set(new TableCommand(this.editor));
|
|
77
|
+
this.editor.commands.set(new TableColumnAddCommand(this.editor));
|
|
78
|
+
this.editor.commands.set(new TableRowAddCommand(this.editor));
|
|
79
|
+
this._toolbar('Table');
|
|
80
|
+
this._focusbar('Add column', 'tablecolumn-add');
|
|
81
|
+
this._focusbar('Add row', 'tablerow-add');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns table section tag configuration
|
|
86
|
+
*
|
|
87
|
+
* @param {string} name
|
|
88
|
+
* @return {Object.<string, any>}
|
|
89
|
+
*/
|
|
90
|
+
#section(name) {
|
|
91
|
+
return {
|
|
92
|
+
name,
|
|
93
|
+
group: TagGroup.TABLESECTION,
|
|
94
|
+
children: [TagGroup.TABLEROW],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns table cell tag configuration
|
|
100
|
+
*
|
|
101
|
+
* @param {string} name
|
|
102
|
+
* @return {Object.<string, any>}
|
|
103
|
+
*/
|
|
104
|
+
#cell(name) {
|
|
105
|
+
return {
|
|
106
|
+
name,
|
|
107
|
+
group: TagGroup.TABLECELL,
|
|
108
|
+
children: [TagGroup.BREAK, TagGroup.FORMAT],
|
|
109
|
+
editable: true,
|
|
110
|
+
empty: true,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|