@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,22 @@
|
|
|
1
|
+
import Blockquote from './Blockquote.js';
|
|
2
|
+
import Filter from '../base/Filter.js';
|
|
3
|
+
import TagName from '../base/TagName.js';
|
|
4
|
+
|
|
5
|
+
export default class BlockquoteFilter 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(Blockquote.name) &&
|
|
15
|
+
element.querySelector(':scope > ' + TagName.BLOCKQUOTE) &&
|
|
16
|
+
!element.querySelector(':scope > ' + TagName.FIGCAPTION)
|
|
17
|
+
) {
|
|
18
|
+
this.editor.dom.insertBefore(element.querySelector(':scope > ' + TagName.BLOCKQUOTE), element);
|
|
19
|
+
element.parentElement.removeChild(element);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Blockquote from './Blockquote.js';
|
|
2
|
+
import Listener from '../base/Listener.js';
|
|
3
|
+
import TagName from '../base/TagName.js';
|
|
4
|
+
|
|
5
|
+
export default class BlockquoteListener extends Listener {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Editor} editor
|
|
8
|
+
*/
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
super(editor);
|
|
11
|
+
this.editor.root.addEventListener('insertblockquote', this);
|
|
12
|
+
this.editor.root.addEventListener('deleteblockquote', this);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {CustomEvent} event
|
|
17
|
+
* @param {HTMLQuoteElement} event.detail.element
|
|
18
|
+
* @return {void}
|
|
19
|
+
*/
|
|
20
|
+
insertblockquote({ detail: { element } }) {
|
|
21
|
+
this.editor.dom.wrap(element, TagName.FIGURE, { attributes: { class: Blockquote.name } });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {CustomEvent} event
|
|
26
|
+
* @param {HTMLElement} event.detail.target
|
|
27
|
+
* @return {void}
|
|
28
|
+
*/
|
|
29
|
+
deleteblockquote({ detail: { target } }) {
|
|
30
|
+
if (target.localName === TagName.FIGURE && target.classList.contains(Blockquote.name)) {
|
|
31
|
+
target.parentElement.removeChild(target);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/bold/Bold.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 Bold extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'bold';
|
|
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.B, group: TagGroup.FORMAT });
|
|
27
|
+
this._command(TagName.B);
|
|
28
|
+
this._formatbar('bold', Key.B);
|
|
29
|
+
}
|
|
30
|
+
}
|
package/break/Break.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Base from '../base/Base.js';
|
|
2
|
+
import BreakFilter from './BreakFilter.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 Break extends Plugin {
|
|
8
|
+
/**
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
static get name() {
|
|
12
|
+
return 'break';
|
|
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.BR,
|
|
28
|
+
group: TagGroup.BREAK,
|
|
29
|
+
empty: true,
|
|
30
|
+
});
|
|
31
|
+
this.editor.filters.add(new BreakFilter(this.editor));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Filter from '../base/Filter.js';
|
|
2
|
+
|
|
3
|
+
export default class BreakFilter extends Filter {
|
|
4
|
+
/**
|
|
5
|
+
* @param {HTMLElement} element
|
|
6
|
+
* @return {void}
|
|
7
|
+
*/
|
|
8
|
+
filter(element) {
|
|
9
|
+
if (element instanceof HTMLPreElement) {
|
|
10
|
+
element.outerHTML = element.outerHTML.replace(/(<br\s*\/?>)/gi, '\n');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
element.innerHTML = element.innerHTML
|
|
15
|
+
.replace(/^\s*(<br\s*\/?>\s*)+/gi, '')
|
|
16
|
+
.replace(/\s*(<br\s*\/?>\s*)+$/gi, '');
|
|
17
|
+
|
|
18
|
+
if (element instanceof HTMLParagraphElement) {
|
|
19
|
+
element.outerHTML = element.outerHTML.replace(/\s*(<br\s*\/?>\s*){2,}/gi, '</p><p>');
|
|
20
|
+
} else {
|
|
21
|
+
element.innerHTML = element.innerHTML.replace(/\s*(<br\s*\/?>\s*){2,}/gi, '<br>');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import Abbreviation from '../abbreviation/Abbreviation.js';
|
|
2
|
+
import Audio from '../audio/Audio.js';
|
|
3
|
+
import Block from '../block/Block.js';
|
|
4
|
+
import Blockquote from '../blockquote/Blockquote.js';
|
|
5
|
+
import Bold from '../bold/Bold.js';
|
|
6
|
+
import Cite from '../cite/Cite.js';
|
|
7
|
+
import Code from '../code/Code.js';
|
|
8
|
+
import Data from '../data/Data.js';
|
|
9
|
+
import Definition from '../definition/Definition.js';
|
|
10
|
+
import Deletion from '../deletion/Deletion.js';
|
|
11
|
+
import Details from '../details/Details.js';
|
|
12
|
+
import Division from '../division/Division.js';
|
|
13
|
+
import Editor from '../base/Editor.js';
|
|
14
|
+
import Emphasis from '../emphasis/Emphasis.js';
|
|
15
|
+
import Heading from '../heading/Heading.js';
|
|
16
|
+
import HorizontalRule from '../horizontalrule/HorizontalRule.js';
|
|
17
|
+
import I18n from '../i18n/I18n.js';
|
|
18
|
+
import Iframe from '../iframe/Iframe.js';
|
|
19
|
+
import Image from '../image/Image.js';
|
|
20
|
+
import Insertion from '../insertion/Insertion.js';
|
|
21
|
+
import Italic from '../italic/Italic.js';
|
|
22
|
+
import Keyboard from '../keyboard/Keyboard.js';
|
|
23
|
+
import Link from '../link/Link.js';
|
|
24
|
+
import Mark from '../mark/Mark.js';
|
|
25
|
+
import OrderedList from '../orderedlist/OrderedList.js';
|
|
26
|
+
import Paragraph from '../paragraph/Paragraph.js';
|
|
27
|
+
import Preformat from '../preformat/Preformat.js';
|
|
28
|
+
import Quote from '../quote/Quote.js';
|
|
29
|
+
import Sample from '../sample/Sample.js';
|
|
30
|
+
import Section from '../section/Section.js';
|
|
31
|
+
import Small from '../small/Small.js';
|
|
32
|
+
import Strikethrough from '../strikethrough/Strikethrough.js';
|
|
33
|
+
import Strong from '../strong/Strong.js';
|
|
34
|
+
import Subheading from '../subheading/Subheading.js';
|
|
35
|
+
import Subscript from '../subscript/Subscript.js';
|
|
36
|
+
import Superscript from '../superscript/Superscript.js';
|
|
37
|
+
import Table from '../table/Table.js';
|
|
38
|
+
import Time from '../time/Time.js';
|
|
39
|
+
import Underline from '../underline/Underline.js';
|
|
40
|
+
import UnorderedList from '../unorderedlist/UnorderedList.js';
|
|
41
|
+
import Variable from '../variable/Variable.js';
|
|
42
|
+
import Video from '../video/Video.js';
|
|
43
|
+
|
|
44
|
+
export default class BuildEditor extends Editor {
|
|
45
|
+
/**
|
|
46
|
+
* @type {Object.<string, Object>}
|
|
47
|
+
*/
|
|
48
|
+
static get defaultConfig() {
|
|
49
|
+
return {
|
|
50
|
+
base: {
|
|
51
|
+
plugins: [
|
|
52
|
+
I18n,
|
|
53
|
+
Bold,
|
|
54
|
+
Italic,
|
|
55
|
+
Strong,
|
|
56
|
+
Emphasis,
|
|
57
|
+
Underline,
|
|
58
|
+
Strikethrough,
|
|
59
|
+
Link,
|
|
60
|
+
Mark,
|
|
61
|
+
Small,
|
|
62
|
+
Definition,
|
|
63
|
+
Abbreviation,
|
|
64
|
+
Quote,
|
|
65
|
+
Cite,
|
|
66
|
+
Code,
|
|
67
|
+
Keyboard,
|
|
68
|
+
Sample,
|
|
69
|
+
Variable,
|
|
70
|
+
Subscript,
|
|
71
|
+
Superscript,
|
|
72
|
+
Time,
|
|
73
|
+
Data,
|
|
74
|
+
Insertion,
|
|
75
|
+
Deletion,
|
|
76
|
+
Paragraph,
|
|
77
|
+
Heading,
|
|
78
|
+
Subheading,
|
|
79
|
+
UnorderedList,
|
|
80
|
+
OrderedList,
|
|
81
|
+
HorizontalRule,
|
|
82
|
+
Blockquote,
|
|
83
|
+
Image,
|
|
84
|
+
Video,
|
|
85
|
+
Audio,
|
|
86
|
+
Iframe,
|
|
87
|
+
Table,
|
|
88
|
+
Preformat,
|
|
89
|
+
Section,
|
|
90
|
+
Details,
|
|
91
|
+
Division,
|
|
92
|
+
Block,
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|