@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,183 @@
1
+ export default class TagGroup {
2
+ /**
3
+ * @return {string}
4
+ */
5
+ static get AUDIO() {
6
+ return 'audio';
7
+ }
8
+
9
+ /**
10
+ * @return {string}
11
+ */
12
+ static get BLOCK() {
13
+ return 'block';
14
+ }
15
+
16
+ /**
17
+ * @return {string}
18
+ */
19
+ static get BREAK() {
20
+ return 'break';
21
+ }
22
+
23
+ /**
24
+ * @return {string}
25
+ */
26
+ static get CAPTION() {
27
+ return 'caption';
28
+ }
29
+
30
+ /**
31
+ * @return {string}
32
+ */
33
+ static get COL() {
34
+ return 'col';
35
+ }
36
+
37
+ /**
38
+ * @return {string}
39
+ */
40
+ static get COLGROUP() {
41
+ return 'colgroup';
42
+ }
43
+
44
+ /**
45
+ * @return {string}
46
+ */
47
+ static get CONTAINER() {
48
+ return 'container';
49
+ }
50
+
51
+ /**
52
+ * @return {string}
53
+ */
54
+ static get FIGURE() {
55
+ return 'figure';
56
+ }
57
+
58
+ /**
59
+ * @return {string}
60
+ */
61
+ static get FORMAT() {
62
+ return 'format';
63
+ }
64
+
65
+ /**
66
+ * @return {string}
67
+ */
68
+ static get HEADING() {
69
+ return 'heading';
70
+ }
71
+
72
+ /**
73
+ * @return {string}
74
+ */
75
+ static get IFRAME() {
76
+ return 'iframe';
77
+ }
78
+
79
+ /**
80
+ * @return {string}
81
+ */
82
+ static get IMAGE() {
83
+ return 'image';
84
+ }
85
+
86
+ /**
87
+ * @return {string}
88
+ */
89
+ static get LIST() {
90
+ return 'list';
91
+ }
92
+
93
+ /**
94
+ * @return {string}
95
+ */
96
+ static get LISTITEM() {
97
+ return 'listitem';
98
+ }
99
+
100
+ /**
101
+ * @return {string}
102
+ */
103
+ static get PARAGRAPH() {
104
+ return 'paragraph';
105
+ }
106
+
107
+ /**
108
+ * @return {string}
109
+ */
110
+ static get PREFORMAT() {
111
+ return 'preformat';
112
+ }
113
+
114
+ /**
115
+ * @return {string}
116
+ */
117
+ static get QUOTE() {
118
+ return 'quote';
119
+ }
120
+
121
+ /**
122
+ * @return {string}
123
+ */
124
+ static get ROOT() {
125
+ return 'root';
126
+ }
127
+
128
+ /**
129
+ * @return {string}
130
+ */
131
+ static get RULE() {
132
+ return 'rule';
133
+ }
134
+
135
+ /**
136
+ * @return {string}
137
+ */
138
+ static get SLOT() {
139
+ return 'slot';
140
+ }
141
+
142
+ /**
143
+ * @return {string}
144
+ */
145
+ static get SUMMARY() {
146
+ return 'summary';
147
+ }
148
+
149
+ /**
150
+ * @return {string}
151
+ */
152
+ static get TABLE() {
153
+ return 'table';
154
+ }
155
+
156
+ /**
157
+ * @return {string}
158
+ */
159
+ static get TABLECELL() {
160
+ return 'tablecell';
161
+ }
162
+
163
+ /**
164
+ * @return {string}
165
+ */
166
+ static get TABLEROW() {
167
+ return 'tablerow';
168
+ }
169
+
170
+ /**
171
+ * @return {string}
172
+ */
173
+ static get TABLESECTION() {
174
+ return 'tablesection';
175
+ }
176
+
177
+ /**
178
+ * @return {string}
179
+ */
180
+ static get VIDEO() {
181
+ return 'video';
182
+ }
183
+ }
@@ -0,0 +1,34 @@
1
+ import Listener from './Listener.js';
2
+
3
+ export default class TagListener extends Listener {
4
+ /**
5
+ * @param {Editor} editor
6
+ */
7
+ constructor(editor) {
8
+ super(editor);
9
+ this.editor.root.addEventListener('insert', this);
10
+ }
11
+
12
+ /**
13
+ * @param {CustomEvent} event
14
+ * @param {HTMLElement} event.detail.element
15
+ * @return {void}
16
+ */
17
+ insert({ detail: { element } }) {
18
+ const tag = this.editor.tags.get(element);
19
+
20
+ if (tag) {
21
+ if (tag.editable) {
22
+ element.contentEditable = 'true';
23
+ }
24
+
25
+ ['alignable', 'arbitrary', 'deletable', 'focusable', 'navigable', 'slotable', 'sortable'].forEach(
26
+ (item) => {
27
+ if (tag[item]) {
28
+ element.dataset[item] = '';
29
+ }
30
+ }
31
+ );
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,61 @@
1
+ import Tag from './Tag.js';
2
+
3
+ export default class TagManager {
4
+ /**
5
+ * @type {Map<string, Tag>}
6
+ */
7
+ #items = new Map();
8
+
9
+ /**
10
+ * @param {Tag[]} [tags = []]
11
+ */
12
+ constructor(tags = []) {
13
+ tags.forEach((tag) => this.set(tag));
14
+ }
15
+
16
+ /**
17
+ * @param {string|HTMLElement} key
18
+ * @return {Tag|undefined}
19
+ */
20
+ get(key) {
21
+ return this.#items.get(key instanceof HTMLElement ? key.localName : key);
22
+ }
23
+
24
+ /**
25
+ * @param {Tag} tag
26
+ * @return {void}
27
+ */
28
+ set(tag) {
29
+ if (!(tag instanceof Tag)) {
30
+ throw new TypeError('Invalid argument');
31
+ }
32
+
33
+ this.#items.set(tag.name, tag);
34
+ }
35
+
36
+ /**
37
+ * Checks if tag or group is allowed inside parent tag
38
+ *
39
+ * @param {string|HTMLElement} key
40
+ * @param {string|HTMLElement} childKey
41
+ * @param {boolean} [isGroup = false]
42
+ * @return {boolean}
43
+ */
44
+ allowed(key, childKey, isGroup = false) {
45
+ const group = isGroup ? childKey : this.get(childKey)?.group;
46
+ return !!this.get(key)?.children.includes(group);
47
+ }
48
+
49
+ /**
50
+ * @return {void}
51
+ */
52
+ freeze() {
53
+ this.#items.forEach((tag) => {
54
+ Object.freeze(tag.children);
55
+ Object.freeze(tag.attributes);
56
+ Object.freeze(tag);
57
+ });
58
+ Object.freeze(this.#items);
59
+ Object.freeze(this);
60
+ }
61
+ }