@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.
Files changed (126) hide show
  1. package/abbreviation/Abbreviation.js +32 -0
  2. package/abbreviation/AbbreviationDialog.js +21 -0
  3. package/audio/Audio.js +47 -0
  4. package/audio/AudioDialog.js +18 -0
  5. package/audio/AudioListener.js +50 -0
  6. package/base/AlignCommand.js +34 -0
  7. package/base/AlignableListener.js +45 -0
  8. package/base/Alignment.js +36 -0
  9. package/base/BarListener.js +95 -0
  10. package/base/Base.js +127 -0
  11. package/base/Command.js +139 -0
  12. package/base/CommandManager.js +60 -0
  13. package/base/ContentFilter.js +109 -0
  14. package/base/DeletableListener.js +36 -0
  15. package/base/DeleteCommand.js +18 -0
  16. package/base/Dialog.js +153 -0
  17. package/base/DialogManager.js +44 -0
  18. package/base/Dispatcher.js +88 -0
  19. package/base/Dom.js +790 -0
  20. package/base/EditableListener.js +82 -0
  21. package/base/Editor.js +448 -0
  22. package/base/Filter.js +35 -0
  23. package/base/FilterManager.js +44 -0
  24. package/base/FocusableListener.js +22 -0
  25. package/base/FocusbarListener.js +99 -0
  26. package/base/FormCreator.js +162 -0
  27. package/base/FormatbarListener.js +32 -0
  28. package/base/Key.js +258 -0
  29. package/base/Listener.js +51 -0
  30. package/base/NavigableListener.js +81 -0
  31. package/base/Plugin.js +176 -0
  32. package/base/PluginManager.js +51 -0
  33. package/base/SlotableListener.js +40 -0
  34. package/base/SortCommand.js +30 -0
  35. package/base/SortableListener.js +135 -0
  36. package/base/Sorting.js +36 -0
  37. package/base/Tag.js +113 -0
  38. package/base/TagGroup.js +183 -0
  39. package/base/TagListener.js +34 -0
  40. package/base/TagManager.js +61 -0
  41. package/base/TagName.js +470 -0
  42. package/base/ToolbarListener.js +11 -0
  43. package/base/util.js +59 -0
  44. package/block/Block.js +51 -0
  45. package/block/BlockDialog.js +11 -0
  46. package/block/BlockElement.js +21 -0
  47. package/block/BlockListener.js +60 -0
  48. package/blockquote/Blockquote.js +43 -0
  49. package/blockquote/BlockquoteFilter.js +22 -0
  50. package/blockquote/BlockquoteListener.js +34 -0
  51. package/bold/Bold.js +30 -0
  52. package/break/Break.js +33 -0
  53. package/break/BreakFilter.js +24 -0
  54. package/build/BuildEditor.js +97 -0
  55. package/build/editor.css +548 -0
  56. package/build/editor.woff2 +0 -0
  57. package/cite/Cite.js +30 -0
  58. package/code/Code.js +30 -0
  59. package/data/Data.js +32 -0
  60. package/data/DataDialog.js +13 -0
  61. package/definition/Definition.js +32 -0
  62. package/definition/DefinitionDialog.js +13 -0
  63. package/deletion/Deletion.js +30 -0
  64. package/details/Details.js +63 -0
  65. package/details/DetailsFilter.js +17 -0
  66. package/details/DetailsListener.js +102 -0
  67. package/division/Division.js +53 -0
  68. package/division/DivisionDialog.js +13 -0
  69. package/emphasis/Emphasis.js +30 -0
  70. package/figure/Figure.js +58 -0
  71. package/figure/FigureFilter.js +14 -0
  72. package/figure/FigureListener.js +23 -0
  73. package/heading/Heading.js +38 -0
  74. package/horizontalrule/HorizontalRule.js +37 -0
  75. package/i18n/I18n.js +26 -0
  76. package/i18n/de.js +167 -0
  77. package/iframe/Iframe.js +49 -0
  78. package/iframe/IframeDialog.js +20 -0
  79. package/iframe/IframeListener.js +48 -0
  80. package/image/Image.js +47 -0
  81. package/image/ImageDialog.js +23 -0
  82. package/image/ImageListener.js +47 -0
  83. package/insertion/Insertion.js +30 -0
  84. package/italic/Italic.js +30 -0
  85. package/keyboard/Keyboard.js +30 -0
  86. package/link/Link.js +34 -0
  87. package/link/LinkDialog.js +14 -0
  88. package/link/LinkListener.js +45 -0
  89. package/list/List.js +40 -0
  90. package/list/ListListener.js +91 -0
  91. package/mark/Mark.js +30 -0
  92. package/orderedlist/OrderedList.js +39 -0
  93. package/package.json +24 -0
  94. package/paragraph/Paragraph.js +42 -0
  95. package/paragraph/ParagraphListener.js +40 -0
  96. package/preformat/Preformat.js +43 -0
  97. package/preformat/PreformatFilter.js +22 -0
  98. package/preformat/PreformatListener.js +34 -0
  99. package/quote/Quote.js +30 -0
  100. package/sample/Sample.js +30 -0
  101. package/section/Section.js +55 -0
  102. package/section/SectionDialog.js +13 -0
  103. package/small/Small.js +30 -0
  104. package/strikethrough/Strikethrough.js +30 -0
  105. package/strong/Strong.js +30 -0
  106. package/subheading/Subheading.js +38 -0
  107. package/subscript/Subscript.js +30 -0
  108. package/superscript/Superscript.js +30 -0
  109. package/table/Table.js +113 -0
  110. package/table/TableCellListener.js +125 -0
  111. package/table/TableColumnAddCommand.js +19 -0
  112. package/table/TableColumnListener.js +34 -0
  113. package/table/TableCommand.js +23 -0
  114. package/table/TableDialog.js +14 -0
  115. package/table/TableFilter.js +35 -0
  116. package/table/TableListener.js +39 -0
  117. package/table/TableRowAddCommand.js +18 -0
  118. package/table/TableRowListener.js +34 -0
  119. package/time/Time.js +32 -0
  120. package/time/TimeDialog.js +13 -0
  121. package/underline/Underline.js +30 -0
  122. package/unorderedlist/UnorderedList.js +39 -0
  123. package/variable/Variable.js +30 -0
  124. package/video/Video.js +47 -0
  125. package/video/VideoDialog.js +20 -0
  126. 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
+ }