editable.ts 0.0.1

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 (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +571 -0
  3. package/dist/editable.umd.cjs +2 -0
  4. package/dist/editable.umd.cjs.map +1 -0
  5. package/lib/block.d.ts +13 -0
  6. package/lib/block.d.ts.map +1 -0
  7. package/lib/block.js +58 -0
  8. package/lib/block.js.map +1 -0
  9. package/lib/clipboard.d.ts +22 -0
  10. package/lib/clipboard.d.ts.map +1 -0
  11. package/lib/clipboard.js +154 -0
  12. package/lib/clipboard.js.map +1 -0
  13. package/lib/config.d.ts +37 -0
  14. package/lib/config.d.ts.map +1 -0
  15. package/lib/config.js +64 -0
  16. package/lib/config.js.map +1 -0
  17. package/lib/content.d.ts +37 -0
  18. package/lib/content.d.ts.map +1 -0
  19. package/lib/content.js +526 -0
  20. package/lib/content.js.map +1 -0
  21. package/lib/core.d.ts +97 -0
  22. package/lib/core.d.ts.map +1 -0
  23. package/lib/core.js +261 -0
  24. package/lib/core.js.map +1 -0
  25. package/lib/create-default-behavior.d.ts +31 -0
  26. package/lib/create-default-behavior.d.ts.map +1 -0
  27. package/lib/create-default-behavior.js +178 -0
  28. package/lib/create-default-behavior.js.map +1 -0
  29. package/lib/create-default-events.d.ts +152 -0
  30. package/lib/create-default-events.d.ts.map +1 -0
  31. package/lib/create-default-events.js +183 -0
  32. package/lib/create-default-events.js.map +1 -0
  33. package/lib/cursor.d.ts +68 -0
  34. package/lib/cursor.d.ts.map +1 -0
  35. package/lib/cursor.js +354 -0
  36. package/lib/cursor.js.map +1 -0
  37. package/lib/dispatcher.d.ts +78 -0
  38. package/lib/dispatcher.d.ts.map +1 -0
  39. package/lib/dispatcher.js +416 -0
  40. package/lib/dispatcher.js.map +1 -0
  41. package/lib/eventable.d.ts +2 -0
  42. package/lib/eventable.d.ts.map +1 -0
  43. package/lib/eventable.js +104 -0
  44. package/lib/eventable.js.map +1 -0
  45. package/lib/feature-detection.d.ts +12 -0
  46. package/lib/feature-detection.d.ts.map +1 -0
  47. package/lib/feature-detection.js +42 -0
  48. package/lib/feature-detection.js.map +1 -0
  49. package/lib/highlight-support.d.ts +24 -0
  50. package/lib/highlight-support.d.ts.map +1 -0
  51. package/lib/highlight-support.js +172 -0
  52. package/lib/highlight-support.js.map +1 -0
  53. package/lib/highlight-text.d.ts +21 -0
  54. package/lib/highlight-text.d.ts.map +1 -0
  55. package/lib/highlight-text.js +147 -0
  56. package/lib/highlight-text.js.map +1 -0
  57. package/lib/keyboard.d.ts +33 -0
  58. package/lib/keyboard.d.ts.map +1 -0
  59. package/lib/keyboard.js +189 -0
  60. package/lib/keyboard.js.map +1 -0
  61. package/lib/monitored-highlighting.d.ts +28 -0
  62. package/lib/monitored-highlighting.d.ts.map +1 -0
  63. package/lib/monitored-highlighting.js +194 -0
  64. package/lib/monitored-highlighting.js.map +1 -0
  65. package/lib/node-iterator.d.ts +16 -0
  66. package/lib/node-iterator.d.ts.map +1 -0
  67. package/lib/node-iterator.js +97 -0
  68. package/lib/node-iterator.js.map +1 -0
  69. package/lib/node-type.d.ts +13 -0
  70. package/lib/node-type.d.ts.map +1 -0
  71. package/lib/node-type.js +15 -0
  72. package/lib/node-type.js.map +1 -0
  73. package/lib/parser.d.ts +89 -0
  74. package/lib/parser.d.ts.map +1 -0
  75. package/lib/parser.js +251 -0
  76. package/lib/parser.js.map +1 -0
  77. package/lib/plugins/highlighting/match-collection.d.ts +7 -0
  78. package/lib/plugins/highlighting/match-collection.d.ts.map +1 -0
  79. package/lib/plugins/highlighting/match-collection.js +62 -0
  80. package/lib/plugins/highlighting/match-collection.js.map +1 -0
  81. package/lib/plugins/highlighting/spellcheck-service.d.ts +12 -0
  82. package/lib/plugins/highlighting/spellcheck-service.d.ts.map +1 -0
  83. package/lib/plugins/highlighting/spellcheck-service.js +24 -0
  84. package/lib/plugins/highlighting/spellcheck-service.js.map +1 -0
  85. package/lib/plugins/highlighting/text-search.d.ts +10 -0
  86. package/lib/plugins/highlighting/text-search.d.ts.map +1 -0
  87. package/lib/plugins/highlighting/text-search.js +92 -0
  88. package/lib/plugins/highlighting/text-search.js.map +1 -0
  89. package/lib/plugins/highlighting/whitespace-highlighting.d.ts +14 -0
  90. package/lib/plugins/highlighting/whitespace-highlighting.d.ts.map +1 -0
  91. package/lib/plugins/highlighting/whitespace-highlighting.js +52 -0
  92. package/lib/plugins/highlighting/whitespace-highlighting.js.map +1 -0
  93. package/lib/quotes.d.ts +8 -0
  94. package/lib/quotes.d.ts.map +1 -0
  95. package/lib/quotes.js +170 -0
  96. package/lib/quotes.js.map +1 -0
  97. package/lib/range-container.d.ts +22 -0
  98. package/lib/range-container.d.ts.map +1 -0
  99. package/lib/range-container.js +52 -0
  100. package/lib/range-container.js.map +1 -0
  101. package/lib/range-save-restore.d.ts +13 -0
  102. package/lib/range-save-restore.d.ts.map +1 -0
  103. package/lib/range-save-restore.js +153 -0
  104. package/lib/range-save-restore.js.map +1 -0
  105. package/lib/selection-watcher.d.ts +55 -0
  106. package/lib/selection-watcher.d.ts.map +1 -0
  107. package/lib/selection-watcher.js +126 -0
  108. package/lib/selection-watcher.js.map +1 -0
  109. package/lib/selection.d.ts +74 -0
  110. package/lib/selection.d.ts.map +1 -0
  111. package/lib/selection.js +341 -0
  112. package/lib/selection.js.map +1 -0
  113. package/lib/smartQuotes.d.ts +16 -0
  114. package/lib/smartQuotes.d.ts.map +1 -0
  115. package/lib/smartQuotes.js +92 -0
  116. package/lib/smartQuotes.js.map +1 -0
  117. package/lib/util/binary_search.d.ts +23 -0
  118. package/lib/util/binary_search.d.ts.map +1 -0
  119. package/lib/util/binary_search.js +137 -0
  120. package/lib/util/binary_search.js.map +1 -0
  121. package/lib/util/clone-deep.d.ts +8 -0
  122. package/lib/util/clone-deep.d.ts.map +1 -0
  123. package/lib/util/clone-deep.js +10 -0
  124. package/lib/util/clone-deep.js.map +1 -0
  125. package/lib/util/dom.d.ts +43 -0
  126. package/lib/util/dom.d.ts.map +1 -0
  127. package/lib/util/dom.js +272 -0
  128. package/lib/util/dom.js.map +1 -0
  129. package/lib/util/element.d.ts +10 -0
  130. package/lib/util/element.d.ts.map +1 -0
  131. package/lib/util/element.js +29 -0
  132. package/lib/util/element.js.map +1 -0
  133. package/lib/util/error.d.ts +2 -0
  134. package/lib/util/error.d.ts.map +1 -0
  135. package/lib/util/error.js +16 -0
  136. package/lib/util/error.js.map +1 -0
  137. package/lib/util/log.d.ts +2 -0
  138. package/lib/util/log.d.ts.map +1 -0
  139. package/lib/util/log.js +18 -0
  140. package/lib/util/log.js.map +1 -0
  141. package/lib/util/merge.d.ts +6 -0
  142. package/lib/util/merge.d.ts.map +1 -0
  143. package/lib/util/merge.js +31 -0
  144. package/lib/util/merge.js.map +1 -0
  145. package/lib/util/string.d.ts +25 -0
  146. package/lib/util/string.d.ts.map +1 -0
  147. package/lib/util/string.js +68 -0
  148. package/lib/util/string.js.map +1 -0
  149. package/lib/util/viewport.d.ts +6 -0
  150. package/lib/util/viewport.d.ts.map +1 -0
  151. package/lib/util/viewport.js +8 -0
  152. package/lib/util/viewport.js.map +1 -0
  153. package/package.json +86 -0
@@ -0,0 +1,183 @@
1
+ import createDefaultBehavior from './create-default-behavior.js';
2
+ export default function createDefaultEvents(editable) {
3
+ const behavior = createDefaultBehavior(editable);
4
+ return {
5
+ /**
6
+ * The focus event is triggered when an element gains focus.
7
+ * The default behavior is to... TODO
8
+ *
9
+ * @event focus
10
+ * @param {HTMLElement} element The element triggering the event.
11
+ */
12
+ focus(element) {
13
+ behavior.focus(element);
14
+ },
15
+ /**
16
+ * The blur event is triggered when an element looses focus.
17
+ * The default behavior is to... TODO
18
+ *
19
+ * @event blur
20
+ * @param {HTMLElement} element The element triggering the event.
21
+ */
22
+ blur(element) {
23
+ behavior.blur(element);
24
+ },
25
+ /**
26
+ * The selection event is triggered after the user has selected some
27
+ * content.
28
+ * The default behavior is to... TODO
29
+ *
30
+ * @event selection
31
+ * @param {HTMLElement} element The element triggering the event.
32
+ * @param {Selection} selection The actual Selection object.
33
+ */
34
+ selection(element, selection) {
35
+ behavior.selection(element, selection);
36
+ },
37
+ /**
38
+ * The cursor event is triggered after cursor position has changed.
39
+ * The default behavior is to... TODO
40
+ *
41
+ * @event cursor
42
+ * @param {HTMLElement} element The element triggering the event.
43
+ * @param {Cursor} cursor The actual Cursor object.
44
+ */
45
+ cursor(element, cursor) {
46
+ behavior.cursor(element, cursor);
47
+ },
48
+ /**
49
+ * The newline event is triggered when a newline should be inserted. This
50
+ * happens when SHIFT+ENTER key is pressed.
51
+ * The default behavior is to add a <br />
52
+ *
53
+ * @event newline
54
+ * @param {HTMLElement} element The element triggering the event.
55
+ * @param {Cursor} cursor The actual cursor object.
56
+ */
57
+ newline(element, cursor) {
58
+ behavior.newline(element, cursor);
59
+ },
60
+ /**
61
+ * The split event is triggered when a block should be split into two
62
+ * blocks. This happens when ENTER is pressed within a non-empty block.
63
+ * The default behavior is to... TODO
64
+ *
65
+ * @event split
66
+ * @param {HTMLElement} element The element triggering the event.
67
+ * @param {String} before The HTML string before the split.
68
+ * @param {String} after The HTML string after the split.
69
+ * @param {Cursor} cursor The actual cursor object.
70
+ */
71
+ split(element, before, after, cursor) {
72
+ behavior.split(element, before, after, cursor);
73
+ },
74
+ /**
75
+ * The insert event is triggered when a new block should be inserted. This
76
+ * happens when ENTER key is pressed at the beginning of a block (should
77
+ * insert before) or at the end of a block (should insert after).
78
+ * The default behavior is to... TODO
79
+ *
80
+ * @event insert
81
+ * @param {HTMLElement} element The element triggering the event.
82
+ * @param {String} direction The insert direction: "before" or "after".
83
+ * @param {Cursor} cursor The actual cursor object.
84
+ */
85
+ insert(element, direction, cursor) {
86
+ behavior.insert(element, direction, cursor);
87
+ },
88
+ /**
89
+ * The merge event is triggered when two needs to be merged. This happens
90
+ * when BACKSPACE is pressed at the beginning of a block (should merge with
91
+ * the preceding block) or DEL is pressed at the end of a block (should
92
+ * merge with the following block).
93
+ * The default behavior is to... TODO
94
+ *
95
+ * @event merge
96
+ * @param {HTMLElement} element The element triggering the event.
97
+ * @param {String} direction The merge direction: "before" or "after".
98
+ * @param {Cursor} cursor The actual cursor object.
99
+ */
100
+ merge(element, direction, cursor) {
101
+ behavior.merge(element, direction, cursor);
102
+ },
103
+ /**
104
+ * The empty event is triggered when a block is emptied.
105
+ * The default behavior is to... TODO
106
+ *
107
+ * @event empty
108
+ * @param {HTMLElement} element The element triggering the event.
109
+ */
110
+ empty(element) {
111
+ behavior.empty(element);
112
+ },
113
+ /**
114
+ * The switch event is triggered when the user switches to another block.
115
+ * This happens when an ARROW key is pressed near the boundaries of a block.
116
+ * The default behavior is to... TODO
117
+ *
118
+ * @event switch
119
+ * @param {HTMLElement} element The element triggering the event.
120
+ * @param {String} direction The switch direction: "before" or "after".
121
+ * @param {Cursor} cursor The actual cursor object.*
122
+ */
123
+ switch(element, direction, cursor) {
124
+ behavior.switch(element, direction, cursor);
125
+ },
126
+ /**
127
+ * The move event is triggered when the user moves a selection in a block.
128
+ * This happens when the user selects some (or all) content in a block and
129
+ * an ARROW key is pressed (up: drag before, down: drag after).
130
+ * The default behavior is to... TODO
131
+ *
132
+ * @event move
133
+ * @param {HTMLElement} element The element triggering the event.
134
+ * @param {Selection} selection The actual Selection object.
135
+ * @param {String} direction The move direction: "before" or "after".
136
+ */
137
+ move(element, selection, direction) {
138
+ behavior.move(element, selection, direction);
139
+ },
140
+ /**
141
+ * The clipboard event is triggered when the user copies or cuts
142
+ * a selection within a block.
143
+ *
144
+ * @event clipboard
145
+ * @param {HTMLElement} element The element triggering the event.
146
+ * @param {String} action The clipboard action: "copy" or "cut".
147
+ * @param {Selection} selection A selection object around the copied content.
148
+ */
149
+ clipboard(element, action, selection) {
150
+ behavior.clipboard(element, action, selection);
151
+ },
152
+ /**
153
+ * The paste event is triggered when the user pastes text
154
+ *
155
+ * @event paste
156
+ * @param {HTMLElement} The element triggering the event.
157
+ * @param {Array of String} The pasted blocks
158
+ * @param {Cursor} The cursor object.
159
+ */
160
+ paste(element, blocks, cursor) {
161
+ behavior.paste(element, blocks, cursor);
162
+ },
163
+ /**
164
+ * The toggleBold event is triggered when the bold keyboard shortcut is used
165
+ *
166
+ * @event toggleBold
167
+ * @param {Selection} The selection object.
168
+ */
169
+ toggleBold(selection) {
170
+ behavior.toggleBold(selection);
171
+ },
172
+ /**
173
+ * The toggleEmphasis event is triggered when the italic keyboard shortcut is used
174
+ *
175
+ * @event toggleEmphasis
176
+ * @param {Selection} The selection object.
177
+ */
178
+ toggleEmphasis(selection) {
179
+ behavior.toggleEmphasis(selection);
180
+ }
181
+ };
182
+ }
183
+ //# sourceMappingURL=create-default-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-default-events.js","sourceRoot":"","sources":["../src/create-default-events.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,8BAA8B,CAAA;AAKhE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,QAAkB;IAC7D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;IAEhD,OAAO;QACL;;;;;;WAMG;QACH,KAAK,CAAE,OAAoB;YACzB,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACzB,CAAC;QAED;;;;;;WAMG;QACH,IAAI,CAAE,OAAoB;YACxB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACxB,CAAC;QAED;;;;;;;;WAQG;QACH,SAAS,CAAE,OAAoB,EAAE,SAAoB;YACnD,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;QACxC,CAAC;QAED;;;;;;;WAOG;QACH,MAAM,CAAE,OAAoB,EAAE,MAAc;YAC1C,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAClC,CAAC;QAED;;;;;;;;WAQG;QACH,OAAO,CAAE,OAAoB,EAAE,MAAc;YAC3C,QAAQ,CAAC,OAAO,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AM,EAAE,MAAM,CAAC,CAAA;QACzC,CAAC;QAED;;;;;WAKG;QACH,UAAU,CAAE,SAAoB;YAC9B,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QAChC,CAAC;QAED;;;;;WAKG;QACH,cAAc,CAAE,SAAoB;YAClC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACpC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The Cursor module provides a cross-browser abstraction layer for cursor.
3
+ *
4
+ * @module core
5
+ * @submodule cursor
6
+ */
7
+ export default class Cursor {
8
+ host: HTMLElement;
9
+ range: Range;
10
+ win: Window;
11
+ isCursor?: boolean;
12
+ isSelection?: boolean;
13
+ private savedRangeInfo?;
14
+ static findHost(elem: Node, selector: string): HTMLElement | undefined;
15
+ /**
16
+ * Class for the Cursor module.
17
+ *
18
+ * @class Cursor
19
+ * @constructor
20
+ */
21
+ constructor(editableHost: HTMLElement, range: Range);
22
+ getTags(filterFunc?: ((node: Node) => boolean) | null): Node[];
23
+ getTagNames(filterFunc?: ((node: Node) => boolean) | null): string[];
24
+ getTagsByName(tagName: string): Node[];
25
+ getInnerTags(filterFunc?: ((node: Node) => boolean) | null): Node[];
26
+ getContainedTags(filterFunc?: (node: Node) => boolean): Node[];
27
+ getAncestorTags(filterFunc?: (node: Node) => boolean): Node[];
28
+ isAtEnd(): boolean;
29
+ isAtTextEnd(): boolean;
30
+ isAtLastLine(): boolean;
31
+ isAtFirstLine(): boolean;
32
+ isAtBeginning(): boolean;
33
+ insertBefore(element: Node | string): void;
34
+ insertAfter(element: Node): void;
35
+ setSelection(): void;
36
+ setVisibleSelection(): void;
37
+ before(): DocumentFragment;
38
+ textBefore(): string;
39
+ beforeHtml(): string;
40
+ after(): DocumentFragment;
41
+ textAfter(): string;
42
+ afterHtml(): string;
43
+ getBoundingClientRect(): DOMRect;
44
+ getCoordinates(positioning?: string): DOMRect | {
45
+ top: number;
46
+ bottom: number;
47
+ left: number;
48
+ right: number;
49
+ height: number;
50
+ width: number;
51
+ };
52
+ moveBefore(element: Node): Cursor | void;
53
+ moveAfter(element: Node): Cursor | void;
54
+ moveAtBeginning(element?: HTMLElement): Cursor | void;
55
+ moveAtEnd(element?: HTMLElement): Cursor | void;
56
+ moveAtTextEnd(element: HTMLElement): Cursor | void;
57
+ setHost(element: HTMLElement | any): void;
58
+ updateHost(element: Node): void;
59
+ retainVisibleSelection(callback: () => void): void;
60
+ save(): void;
61
+ restore(): void;
62
+ equals(cursor: Cursor | null | undefined): boolean;
63
+ createElement(tagName: string, attributes?: Record<string, string>): HTMLElement;
64
+ createTextNode(text: string): Text;
65
+ adoptElement(node: Node): Node;
66
+ triggerChange(): void;
67
+ }
68
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../src/cursor.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,OAAO,MAAM;IAClB,IAAI,EAAG,WAAW,CAAA;IAClB,KAAK,EAAG,KAAK,CAAA;IACb,GAAG,EAAG,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,CAAC,cAAc,CAAC,CAAkC;IAEzD,MAAM,CAAC,QAAQ,CAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIvE;;;;;MAKE;gBACW,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;IAYpD,OAAO,CAAE,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE;IAU/D,WAAW,CAAE,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM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AAS,GAAG,OAAO;IAcnD,aAAa,CAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,WAAW;IASrF,cAAc,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAMnC,YAAY,CAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAO/B,aAAa;CAId"}
package/lib/cursor.js ADDED
@@ -0,0 +1,354 @@
1
+ import * as viewport from './util/viewport.js';
2
+ import * as content from './content.js';
3
+ import * as parser from './parser.js';
4
+ import * as string from './util/string.js';
5
+ import { elementNode, documentFragmentNode } from './node-type.js';
6
+ import error from './util/error.js';
7
+ import * as rangeSaveRestore from './range-save-restore.js';
8
+ import { closest, getSelection, rangesAreEqual } from './util/dom.js';
9
+ /**
10
+ * The Cursor module provides a cross-browser abstraction layer for cursor.
11
+ *
12
+ * @module core
13
+ * @submodule cursor
14
+ */
15
+ export default class Cursor {
16
+ static findHost(elem, selector) {
17
+ return closest(elem, selector);
18
+ }
19
+ /**
20
+ * Class for the Cursor module.
21
+ *
22
+ * @class Cursor
23
+ * @constructor
24
+ */
25
+ constructor(editableHost, range) {
26
+ this.setHost(editableHost);
27
+ this.range = range;
28
+ this.isCursor = true;
29
+ }
30
+ // Get all tags that affect the current selection. Optionally pass a
31
+ // method to filter the returned elements.
32
+ //
33
+ // @param {Function filter(node)} [Optional] Method to filter the returned
34
+ // DOM Nodes.
35
+ // @return {Array of DOM Nodes}
36
+ getTags(filterFunc) {
37
+ return content.getTags(this.host, this.range, filterFunc);
38
+ }
39
+ // Get the names of all tags that affect the current selection. Optionally
40
+ // pass a method to filter the returned elements.
41
+ //
42
+ // @param {Function filter(node)} [Optional] Method to filter the DOM
43
+ // Nodes whose names are returned.
44
+ // @return {Array<String> of tag names}
45
+ getTagNames(filterFunc) {
46
+ const tags = this.getTags(filterFunc);
47
+ return content.getTagNames(tags);
48
+ }
49
+ // Get all tags of the specified type that affect the current selection.
50
+ //
51
+ // @method getTagsByName
52
+ // @param {String} tagName. E.g. 'a' to get all links.
53
+ // @return {Array of DOM Nodes}
54
+ getTagsByName(tagName) {
55
+ return content.getTagsByName(this.host, this.range, tagName);
56
+ }
57
+ // Get all tags that are completely within the current selection.
58
+ getInnerTags(filterFunc) {
59
+ return content.getInnerTags(this.range, filterFunc);
60
+ }
61
+ // Get all tags whose text is completely within the current selection.
62
+ getContainedTags(filterFunc) {
63
+ return content.getContainedTags(this.range, filterFunc);
64
+ }
65
+ // Get all tags that surround the current selection.
66
+ getAncestorTags(filterFunc) {
67
+ return content.getAncestorTags(this.host, this.range, filterFunc);
68
+ }
69
+ isAtEnd() {
70
+ return parser.isEndOfHost(this.host, this.range.endContainer, this.range.endOffset);
71
+ }
72
+ isAtTextEnd() {
73
+ return parser.isTextEndOfHost(this.host, this.range.endContainer, this.range.endOffset);
74
+ }
75
+ isAtLastLine() {
76
+ const hostRange = this.win.document.createRange();
77
+ hostRange.selectNodeContents(this.host);
78
+ hostRange.collapse(false);
79
+ const hostCoords = getRangeBoundingClientRect(hostRange, this.win);
80
+ const cursorCoords = getRangeBoundingClientRect(this.range, this.win);
81
+ return isCloseTo(hostCoords.bottom, cursorCoords.bottom);
82
+ }
83
+ isAtFirstLine() {
84
+ const hostRange = this.win.document.createRange();
85
+ hostRange.selectNodeContents(this.host);
86
+ hostRange.collapse(true);
87
+ const hostCoords = getRangeBoundingClientRect(hostRange, this.win);
88
+ const cursorCoords = getRangeBoundingClientRect(this.range, this.win);
89
+ return isCloseTo(hostCoords.top, cursorCoords.top);
90
+ }
91
+ isAtBeginning() {
92
+ return parser.isBeginningOfHost(this.host, this.range.startContainer, this.range.startOffset);
93
+ }
94
+ // Insert content before the cursor
95
+ //
96
+ // @param {String, DOM node or document fragment}
97
+ insertBefore(element) {
98
+ if (string.isString(element))
99
+ element = content.createFragmentFromString(element);
100
+ if (parser.isDocumentFragmentWithoutChildren(element))
101
+ return;
102
+ element = this.adoptElement(element);
103
+ let preceedingElement = element;
104
+ if (element.nodeType === documentFragmentNode) {
105
+ const lastIndex = element.childNodes.length - 1;
106
+ preceedingElement = element.childNodes[lastIndex];
107
+ }
108
+ this.range.insertNode(element);
109
+ this.range.setStartAfter(preceedingElement);
110
+ this.range.setEndAfter(preceedingElement);
111
+ this.host.normalize(); // mend text nodes
112
+ }
113
+ // Insert content after the cursor
114
+ //
115
+ // @param {String, DOM node or document fragment}
116
+ insertAfter(element) {
117
+ if (string.isString(element))
118
+ element = content.createFragmentFromString(element);
119
+ if (parser.isDocumentFragmentWithoutChildren(element))
120
+ return;
121
+ element = this.adoptElement(element);
122
+ const after = this.range.cloneRange();
123
+ after.setStart(after.endContainer, after.endOffset);
124
+ after.collapse(true);
125
+ after.insertNode(element);
126
+ this.host.normalize(); // mend text nodes
127
+ }
128
+ // Alias for #setVisibleSelection()
129
+ setSelection() {
130
+ this.setVisibleSelection();
131
+ }
132
+ setVisibleSelection() {
133
+ if (this.win.document.activeElement !== this.host) {
134
+ const { x, y } = viewport.getScrollPosition(this.win);
135
+ this.win.scrollTo(x, y);
136
+ }
137
+ const selection = getSelection(this.win);
138
+ if (!selection)
139
+ return;
140
+ selection.removeAllRanges();
141
+ selection.addRange(this.range);
142
+ }
143
+ // Take the following example:
144
+ // (The character '|' represents the cursor position)
145
+ //
146
+ // <div contenteditable="true">fo|o</div>
147
+ // before() will return a document fragment containing a text node 'fo'.
148
+ //
149
+ // @returns {Document Fragment} content before the cursor or selection.
150
+ before() {
151
+ const range = this.range.cloneRange();
152
+ range.collapse(true);
153
+ range.setStartBefore(this.host);
154
+ return content.cloneRangeContents(range);
155
+ }
156
+ textBefore() {
157
+ const range = this.range.cloneRange();
158
+ range.collapse(true);
159
+ range.setStartBefore(this.host);
160
+ return range.toString();
161
+ }
162
+ // Same as before() but returns a string.
163
+ beforeHtml() {
164
+ return content.getInnerHtmlOfFragment(this.before());
165
+ }
166
+ // Take the following example:
167
+ // (The character '|' represents the cursor position)
168
+ //
169
+ // <div contenteditable="true">fo|o</div>
170
+ // after() will return a document fragment containing a text node 'o'.
171
+ //
172
+ // @returns {Document Fragment} content after the cursor or selection.
173
+ after() {
174
+ const range = this.range.cloneRange();
175
+ range.collapse(false);
176
+ range.setEndAfter(this.host);
177
+ return content.cloneRangeContents(range);
178
+ }
179
+ textAfter() {
180
+ const range = this.range.cloneRange();
181
+ range.collapse(false);
182
+ range.setEndAfter(this.host);
183
+ return range.toString();
184
+ }
185
+ // Same as after() but returns a string.
186
+ afterHtml() {
187
+ return content.getInnerHtmlOfFragment(this.after());
188
+ }
189
+ getBoundingClientRect() {
190
+ return this.range.getBoundingClientRect();
191
+ }
192
+ // Get the BoundingClientRect of the cursor.
193
+ // The returned values are transformed to be absolute
194
+ // (relative to the document).
195
+ getCoordinates(positioning = 'absolute') {
196
+ const coords = this.range.getBoundingClientRect();
197
+ if (positioning === 'fixed')
198
+ return coords;
199
+ // translate into absolute positions
200
+ const { x, y } = viewport.getScrollPosition(this.win);
201
+ return {
202
+ top: coords.top + y,
203
+ bottom: coords.bottom + y,
204
+ left: coords.left + x,
205
+ right: coords.right + x,
206
+ height: coords.height,
207
+ width: coords.width
208
+ };
209
+ }
210
+ moveBefore(element) {
211
+ this.updateHost(element);
212
+ this.range.setStartBefore(element);
213
+ this.range.setEndBefore(element);
214
+ if (this.isSelection)
215
+ return new Cursor(this.host, this.range);
216
+ }
217
+ moveAfter(element) {
218
+ this.updateHost(element);
219
+ this.range.setEndAfter(element);
220
+ this.range.setStartAfter(element);
221
+ if (this.isSelection)
222
+ return new Cursor(this.host, this.range);
223
+ }
224
+ // Move the cursor to the beginning of the host.
225
+ moveAtBeginning(element = this.host) {
226
+ this.updateHost(element);
227
+ this.range.selectNodeContents(element);
228
+ this.range.collapse(true);
229
+ if (this.isSelection)
230
+ return new Cursor(this.host, this.range);
231
+ }
232
+ // Move the cursor to the end of the host.
233
+ moveAtEnd(element = this.host) {
234
+ this.updateHost(element);
235
+ this.range.selectNodeContents(element);
236
+ this.range.collapse(false);
237
+ if (this.isSelection)
238
+ return new Cursor(this.host, this.range);
239
+ }
240
+ // Move the cursor after the last visible character of the host.
241
+ moveAtTextEnd(element) {
242
+ const lastChild = parser.lastChild(element);
243
+ if (lastChild && lastChild.nodeType === elementNode) {
244
+ return this.moveAtEnd(lastChild);
245
+ }
246
+ }
247
+ setHost(element) {
248
+ if (element.jquery)
249
+ element = element[0];
250
+ this.host = element;
251
+ const doc = element.ownerDocument;
252
+ this.win = (element === undefined || element === null || !doc) ? window : (doc.defaultView || window);
253
+ }
254
+ updateHost(element) {
255
+ const host = parser.getHost(element);
256
+ if (!host)
257
+ error('Can not set cursor outside of an editable block');
258
+ this.setHost(host);
259
+ }
260
+ retainVisibleSelection(callback) {
261
+ this.save();
262
+ callback(); // eslint-disable-line callback-return
263
+ this.restore();
264
+ this.setVisibleSelection();
265
+ }
266
+ save() {
267
+ this.savedRangeInfo = rangeSaveRestore.save(this.range);
268
+ this.savedRangeInfo.host = this.host;
269
+ }
270
+ restore() {
271
+ if (!this.savedRangeInfo) {
272
+ error('Could not restore selection');
273
+ return;
274
+ }
275
+ if (this.savedRangeInfo.host) {
276
+ this.host = this.savedRangeInfo.host;
277
+ }
278
+ const restoredRange = rangeSaveRestore.restore(this.host, this.savedRangeInfo);
279
+ if (!restoredRange) {
280
+ error('Could not restore selection range');
281
+ return;
282
+ }
283
+ this.range = restoredRange;
284
+ this.savedRangeInfo = undefined;
285
+ }
286
+ equals(cursor) {
287
+ if (!cursor)
288
+ return false;
289
+ if (!cursor.host)
290
+ return false;
291
+ if (!cursor.host.isEqualNode(this.host))
292
+ return false;
293
+ if (!cursor.range)
294
+ return false;
295
+ if (!rangesAreEqual(cursor.range, this.range))
296
+ return false;
297
+ return true;
298
+ }
299
+ // Create an element with the correct ownerWindow
300
+ // (see: http://www.w3.org/DOM/faq.html#ownerdoc)
301
+ createElement(tagName, attributes = {}) {
302
+ const element = this.win.document.createElement(tagName);
303
+ for (const attributeName in attributes) {
304
+ const attributeValue = attributes[attributeName];
305
+ element.setAttribute(attributeName, attributeValue);
306
+ }
307
+ return element;
308
+ }
309
+ createTextNode(text) {
310
+ return this.win.document.createTextNode(text);
311
+ }
312
+ // Make sure a node has the correct ownerWindow
313
+ // (see: https://developer.mozilla.org/en-US/docs/Web/API/Document/importNode)
314
+ adoptElement(node) {
315
+ return content.adoptElement(node, this.win.document);
316
+ }
317
+ // Currently we call triggerChange manually after format changes.
318
+ // This is to prevent excessive triggering of the change event during
319
+ // merge or split operations or other manipulations by scripts.
320
+ triggerChange() {
321
+ const event = new Event('formatEditable', { bubbles: true, cancelable: false });
322
+ this.host.dispatchEvent(event);
323
+ }
324
+ }
325
+ /**
326
+ * Get position of the range or cursor
327
+ *
328
+ * Can be used to reliably get the boundingClientRect without
329
+ * some any of the drawbacks that the native range has.
330
+ *
331
+ * With the native range.getClientBoundingRect(), newlines are
332
+ * not considered when calculating the position
333
+ *
334
+ * @param {Range} range
335
+ * @param {Window} win
336
+ */
337
+ function getRangeBoundingClientRect(range, win) {
338
+ if (range.startContainer.nodeType !== elementNode)
339
+ return range.getBoundingClientRect();
340
+ const el = win.document.createElement('span');
341
+ el.setAttribute('doc-editable', 'unwrap');
342
+ range.insertNode(el);
343
+ const coords = el.getBoundingClientRect();
344
+ el.remove();
345
+ return coords;
346
+ }
347
+ function isCloseTo(a, b) {
348
+ if (a === b)
349
+ return true;
350
+ if (Math.abs(a - b) <= 2)
351
+ return true;
352
+ return false;
353
+ }
354
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../src/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAE9C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAC,WAAW,EAAE,oBAAoB,EAAC,MAA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