@plotdb/quill 1.0.0

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 (287) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +3 -0
  3. package/assets/base.styl +309 -0
  4. package/assets/bubble/toolbar.styl +14 -0
  5. package/assets/bubble/tooltip.styl +49 -0
  6. package/assets/bubble.styl +45 -0
  7. package/assets/core.styl +215 -0
  8. package/assets/favicon.png +0 -0
  9. package/assets/icons/align-center.svg +5 -0
  10. package/assets/icons/align-justify.svg +5 -0
  11. package/assets/icons/align-left.svg +5 -0
  12. package/assets/icons/align-right.svg +5 -0
  13. package/assets/icons/attachment.svg +3 -0
  14. package/assets/icons/audio.svg +5 -0
  15. package/assets/icons/authorship.svg +5 -0
  16. package/assets/icons/background.svg +52 -0
  17. package/assets/icons/blockquote.svg +6 -0
  18. package/assets/icons/bold.svg +4 -0
  19. package/assets/icons/clean.svg +7 -0
  20. package/assets/icons/code.svg +5 -0
  21. package/assets/icons/color.svg +5 -0
  22. package/assets/icons/comment.svg +3 -0
  23. package/assets/icons/direction-ltr.svg +7 -0
  24. package/assets/icons/direction-rtl.svg +7 -0
  25. package/assets/icons/dropdown.svg +4 -0
  26. package/assets/icons/embed.svg +3 -0
  27. package/assets/icons/emoji.svg +6 -0
  28. package/assets/icons/float-center.svg +5 -0
  29. package/assets/icons/float-full.svg +5 -0
  30. package/assets/icons/float-left.svg +7 -0
  31. package/assets/icons/float-right.svg +7 -0
  32. package/assets/icons/font.svg +5 -0
  33. package/assets/icons/formula.svg +5 -0
  34. package/assets/icons/hashtag.svg +6 -0
  35. package/assets/icons/header-2.svg +3 -0
  36. package/assets/icons/header-3.svg +3 -0
  37. package/assets/icons/header-4.svg +3 -0
  38. package/assets/icons/header-5.svg +3 -0
  39. package/assets/icons/header-6.svg +3 -0
  40. package/assets/icons/header.svg +3 -0
  41. package/assets/icons/horizontal-rule.svg +4 -0
  42. package/assets/icons/image.svg +5 -0
  43. package/assets/icons/indent.svg +6 -0
  44. package/assets/icons/italic.svg +5 -0
  45. package/assets/icons/link.svg +5 -0
  46. package/assets/icons/list-bullet.svg +8 -0
  47. package/assets/icons/list-check.svg +8 -0
  48. package/assets/icons/list-ordered.svg +9 -0
  49. package/assets/icons/map.svg +5 -0
  50. package/assets/icons/mention.svg +4 -0
  51. package/assets/icons/more.svg +3 -0
  52. package/assets/icons/outdent.svg +6 -0
  53. package/assets/icons/redo.svg +4 -0
  54. package/assets/icons/size-decrease.svg +5 -0
  55. package/assets/icons/size-increase.svg +6 -0
  56. package/assets/icons/size.svg +6 -0
  57. package/assets/icons/spacing.svg +9 -0
  58. package/assets/icons/speech.svg +6 -0
  59. package/assets/icons/strike.svg +5 -0
  60. package/assets/icons/subscript.svg +4 -0
  61. package/assets/icons/superscript.svg +4 -0
  62. package/assets/icons/table-border-all.svg +5 -0
  63. package/assets/icons/table-border-bottom.svg +28 -0
  64. package/assets/icons/table-border-left.svg +28 -0
  65. package/assets/icons/table-border-none.svg +25 -0
  66. package/assets/icons/table-border-outside.svg +35 -0
  67. package/assets/icons/table-border-right.svg +28 -0
  68. package/assets/icons/table-border-top.svg +28 -0
  69. package/assets/icons/table-delete-cells.svg +13 -0
  70. package/assets/icons/table-delete-columns.svg +8 -0
  71. package/assets/icons/table-delete-rows.svg +9 -0
  72. package/assets/icons/table-insert-cells.svg +13 -0
  73. package/assets/icons/table-insert-columns.svg +8 -0
  74. package/assets/icons/table-insert-rows.svg +9 -0
  75. package/assets/icons/table-merge-cells.svg +4 -0
  76. package/assets/icons/table-unmerge-cells.svg +7 -0
  77. package/assets/icons/table.svg +11 -0
  78. package/assets/icons/underline.svg +4 -0
  79. package/assets/icons/undo.svg +4 -0
  80. package/assets/icons/video.svg +14 -0
  81. package/assets/snow/toolbar.styl +26 -0
  82. package/assets/snow/tooltip.styl +53 -0
  83. package/assets/snow.styl +18 -0
  84. package/blots/block.d.ts +34 -0
  85. package/blots/block.js +182 -0
  86. package/blots/block.js.map +1 -0
  87. package/blots/break.d.ts +8 -0
  88. package/blots/break.js +21 -0
  89. package/blots/break.js.map +1 -0
  90. package/blots/container.d.ts +4 -0
  91. package/blots/container.js +4 -0
  92. package/blots/container.js.map +1 -0
  93. package/blots/cursor.d.ts +26 -0
  94. package/blots/cursor.js +170 -0
  95. package/blots/cursor.js.map +1 -0
  96. package/blots/embed.d.ts +18 -0
  97. package/blots/embed.js +72 -0
  98. package/blots/embed.js.map +1 -0
  99. package/blots/inline.d.ts +12 -0
  100. package/blots/inline.js +48 -0
  101. package/blots/inline.js.map +1 -0
  102. package/blots/scroll.d.ts +49 -0
  103. package/blots/scroll.js +349 -0
  104. package/blots/scroll.js.map +1 -0
  105. package/blots/text.d.ts +5 -0
  106. package/blots/text.js +16 -0
  107. package/blots/text.js.map +1 -0
  108. package/core/composition.d.ts +12 -0
  109. package/core/composition.js +44 -0
  110. package/core/composition.js.map +1 -0
  111. package/core/editor.d.ts +28 -0
  112. package/core/editor.js +404 -0
  113. package/core/editor.js.map +1 -0
  114. package/core/emitter.d.ts +33 -0
  115. package/core/emitter.js +78 -0
  116. package/core/emitter.js.map +1 -0
  117. package/core/instances.d.ts +3 -0
  118. package/core/instances.js +2 -0
  119. package/core/instances.js.map +1 -0
  120. package/core/logger.d.ts +7 -0
  121. package/core/logger.js +24 -0
  122. package/core/logger.js.map +1 -0
  123. package/core/module.d.ts +8 -0
  124. package/core/module.js +10 -0
  125. package/core/module.js.map +1 -0
  126. package/core/quill.d.ts +218 -0
  127. package/core/quill.js +630 -0
  128. package/core/quill.js.map +1 -0
  129. package/core/selection.d.ts +74 -0
  130. package/core/selection.js +374 -0
  131. package/core/selection.js.map +1 -0
  132. package/core/theme.d.ts +32 -0
  133. package/core/theme.js +28 -0
  134. package/core/theme.js.map +1 -0
  135. package/core/utils/createRegistryWithFormats.d.ts +5 -0
  136. package/core/utils/createRegistryWithFormats.js +29 -0
  137. package/core/utils/createRegistryWithFormats.js.map +1 -0
  138. package/core/utils/scrollRectIntoView.d.ts +11 -0
  139. package/core/utils/scrollRectIntoView.js +110 -0
  140. package/core/utils/scrollRectIntoView.js.map +1 -0
  141. package/core.d.ts +7 -0
  142. package/core.js +37 -0
  143. package/core.js.map +1 -0
  144. package/dist/quill.bubble.css +10 -0
  145. package/dist/quill.bubble.css.map +1 -0
  146. package/dist/quill.core.css +10 -0
  147. package/dist/quill.core.css.map +1 -0
  148. package/dist/quill.core.js +3 -0
  149. package/dist/quill.core.js.LICENSE.txt +7 -0
  150. package/dist/quill.core.js.map +1 -0
  151. package/dist/quill.js +3 -0
  152. package/dist/quill.js.LICENSE.txt +7 -0
  153. package/dist/quill.js.map +1 -0
  154. package/dist/quill.snow.css +10 -0
  155. package/dist/quill.snow.css.map +1 -0
  156. package/formats/align.d.ts +5 -0
  157. package/formats/align.js +10 -0
  158. package/formats/align.js.map +1 -0
  159. package/formats/background.d.ts +5 -0
  160. package/formats/background.js +10 -0
  161. package/formats/background.js.map +1 -0
  162. package/formats/blockquote.d.ts +6 -0
  163. package/formats/blockquote.js +7 -0
  164. package/formats/blockquote.js.map +1 -0
  165. package/formats/bold.d.ts +11 -0
  166. package/formats/bold.js +19 -0
  167. package/formats/bold.js.map +1 -0
  168. package/formats/code.d.ts +15 -0
  169. package/formats/code.js +44 -0
  170. package/formats/code.js.map +1 -0
  171. package/formats/color.d.ts +7 -0
  172. package/formats/color.js +18 -0
  173. package/formats/color.js.map +1 -0
  174. package/formats/direction.d.ts +5 -0
  175. package/formats/direction.js +10 -0
  176. package/formats/direction.js.map +1 -0
  177. package/formats/font.d.ts +7 -0
  178. package/formats/font.js +14 -0
  179. package/formats/font.js.map +1 -0
  180. package/formats/formula.d.ts +10 -0
  181. package/formats/formula.js +34 -0
  182. package/formats/formula.js.map +1 -0
  183. package/formats/header.d.ts +7 -0
  184. package/formats/header.js +10 -0
  185. package/formats/header.js.map +1 -0
  186. package/formats/image.d.ts +13 -0
  187. package/formats/image.js +44 -0
  188. package/formats/image.js.map +1 -0
  189. package/formats/indent.d.ts +8 -0
  190. package/formats/indent.js +30 -0
  191. package/formats/indent.js.map +1 -0
  192. package/formats/italic.d.ts +6 -0
  193. package/formats/italic.js +7 -0
  194. package/formats/italic.js.map +1 -0
  195. package/formats/link.d.ts +13 -0
  196. package/formats/link.js +36 -0
  197. package/formats/link.js.map +1 -0
  198. package/formats/list.d.ts +13 -0
  199. package/formats/list.js +50 -0
  200. package/formats/list.js.map +1 -0
  201. package/formats/script.d.ts +8 -0
  202. package/formats/script.js +21 -0
  203. package/formats/script.js.map +1 -0
  204. package/formats/size.d.ts +4 -0
  205. package/formats/size.js +11 -0
  206. package/formats/size.js.map +1 -0
  207. package/formats/strike.d.ts +6 -0
  208. package/formats/strike.js +7 -0
  209. package/formats/strike.js.map +1 -0
  210. package/formats/table.d.ts +45 -0
  211. package/formats/table.js +176 -0
  212. package/formats/table.js.map +1 -0
  213. package/formats/underline.d.ts +6 -0
  214. package/formats/underline.js +7 -0
  215. package/formats/underline.js.map +1 -0
  216. package/formats/video.d.ts +14 -0
  217. package/formats/video.js +49 -0
  218. package/formats/video.js.map +1 -0
  219. package/modules/clipboard.d.ts +43 -0
  220. package/modules/clipboard.js +477 -0
  221. package/modules/clipboard.js.map +1 -0
  222. package/modules/history.d.ts +36 -0
  223. package/modules/history.js +178 -0
  224. package/modules/history.js.map +1 -0
  225. package/modules/input.d.ts +10 -0
  226. package/modules/input.js +83 -0
  227. package/modules/input.js.map +1 -0
  228. package/modules/keyboard.d.ts +58 -0
  229. package/modules/keyboard.js +713 -0
  230. package/modules/keyboard.js.map +1 -0
  231. package/modules/normalizeExternalHTML/index.d.ts +2 -0
  232. package/modules/normalizeExternalHTML/index.js +12 -0
  233. package/modules/normalizeExternalHTML/index.js.map +1 -0
  234. package/modules/normalizeExternalHTML/normalizers/googleDocs.d.ts +1 -0
  235. package/modules/normalizeExternalHTML/normalizers/googleDocs.js +24 -0
  236. package/modules/normalizeExternalHTML/normalizers/googleDocs.js.map +1 -0
  237. package/modules/normalizeExternalHTML/normalizers/msWord.d.ts +1 -0
  238. package/modules/normalizeExternalHTML/normalizers/msWord.js +87 -0
  239. package/modules/normalizeExternalHTML/normalizers/msWord.js.map +1 -0
  240. package/modules/syntax.d.ts +50 -0
  241. package/modules/syntax.js +332 -0
  242. package/modules/syntax.js.map +1 -0
  243. package/modules/table.d.ts +20 -0
  244. package/modules/table.js +125 -0
  245. package/modules/table.js.map +1 -0
  246. package/modules/tableEmbed.d.ts +27 -0
  247. package/modules/tableEmbed.js +209 -0
  248. package/modules/tableEmbed.js.map +1 -0
  249. package/modules/toolbar.d.ts +24 -0
  250. package/modules/toolbar.js +265 -0
  251. package/modules/toolbar.js.map +1 -0
  252. package/modules/uiNode.d.ts +19 -0
  253. package/modules/uiNode.js +95 -0
  254. package/modules/uiNode.js.map +1 -0
  255. package/modules/uploader.d.ts +15 -0
  256. package/modules/uploader.js +69 -0
  257. package/modules/uploader.js.map +1 -0
  258. package/package.json +102 -0
  259. package/quill.d.ts +5 -0
  260. package/quill.js +82 -0
  261. package/quill.js.map +1 -0
  262. package/themes/base.d.ts +35 -0
  263. package/themes/base.js +257 -0
  264. package/themes/base.js.map +1 -0
  265. package/themes/bubble.d.ts +18 -0
  266. package/themes/bubble.js +114 -0
  267. package/themes/bubble.js.map +1 -0
  268. package/themes/snow.d.ts +9 -0
  269. package/themes/snow.js +122 -0
  270. package/themes/snow.js.map +1 -0
  271. package/types.d.js +2 -0
  272. package/types.d.js.map +1 -0
  273. package/ui/color-picker.d.ts +7 -0
  274. package/ui/color-picker.js +30 -0
  275. package/ui/color-picker.js.map +1 -0
  276. package/ui/icon-picker.d.ts +7 -0
  277. package/ui/icon-picker.js +22 -0
  278. package/ui/icon-picker.js.map +1 -0
  279. package/ui/icons.d.ts +49 -0
  280. package/ui/icons.js +82 -0
  281. package/ui/icons.js.map +1 -0
  282. package/ui/picker.d.ts +16 -0
  283. package/ui/picker.js +171 -0
  284. package/ui/picker.js.map +1 -0
  285. package/ui/tooltip.d.ts +12 -0
  286. package/ui/tooltip.js +56 -0
  287. package/ui/tooltip.js.map +1 -0
@@ -0,0 +1,13 @@
1
+ import Inline from '../blots/inline.js';
2
+ declare class Link extends Inline {
3
+ static blotName: string;
4
+ static tagName: string;
5
+ static SANITIZED_URL: string;
6
+ static PROTOCOL_WHITELIST: string[];
7
+ static create(value: string): HTMLElement;
8
+ static formats(domNode: HTMLElement): string | null;
9
+ static sanitize(url: string): string;
10
+ format(name: string, value: unknown): void;
11
+ }
12
+ declare function sanitize(url: string, protocols: string[]): boolean;
13
+ export { Link as default, sanitize };
@@ -0,0 +1,36 @@
1
+ import Inline from '../blots/inline.js';
2
+ class Link extends Inline {
3
+ static blotName = 'link';
4
+ static tagName = 'A';
5
+ static SANITIZED_URL = 'about:blank';
6
+ static PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'sms'];
7
+ static create(value) {
8
+ const node = super.create(value);
9
+ node.setAttribute('href', this.sanitize(value));
10
+ node.setAttribute('rel', 'noopener noreferrer');
11
+ node.setAttribute('target', '_blank');
12
+ return node;
13
+ }
14
+ static formats(domNode) {
15
+ return domNode.getAttribute('href');
16
+ }
17
+ static sanitize(url) {
18
+ return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
19
+ }
20
+ format(name, value) {
21
+ if (name !== this.statics.blotName || !value) {
22
+ super.format(name, value);
23
+ } else {
24
+ // @ts-expect-error
25
+ this.domNode.setAttribute('href', this.constructor.sanitize(value));
26
+ }
27
+ }
28
+ }
29
+ function sanitize(url, protocols) {
30
+ const anchor = document.createElement('a');
31
+ anchor.href = url;
32
+ const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
33
+ return protocols.indexOf(protocol) > -1;
34
+ }
35
+ export { Link as default, sanitize };
36
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","names":["Inline","Link","blotName","tagName","SANITIZED_URL","PROTOCOL_WHITELIST","create","value","node","setAttribute","sanitize","formats","domNode","getAttribute","url","format","name","statics","constructor","protocols","anchor","document","createElement","href","protocol","slice","indexOf","default"],"sources":["../../src/formats/link.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Link extends Inline {\n static blotName = 'link';\n static tagName = 'A';\n static SANITIZED_URL = 'about:blank';\n static PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'sms'];\n\n static create(value: string) {\n const node = super.create(value) as HTMLElement;\n node.setAttribute('href', this.sanitize(value));\n node.setAttribute('rel', 'noopener noreferrer');\n node.setAttribute('target', '_blank');\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n return domNode.getAttribute('href');\n }\n\n static sanitize(url: string) {\n return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;\n }\n\n format(name: string, value: unknown) {\n if (name !== this.statics.blotName || !value) {\n super.format(name, value);\n } else {\n // @ts-expect-error\n this.domNode.setAttribute('href', this.constructor.sanitize(value));\n }\n }\n}\n\nfunction sanitize(url: string, protocols: string[]) {\n const anchor = document.createElement('a');\n anchor.href = url;\n const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));\n return protocols.indexOf(protocol) > -1;\n}\n\nexport { Link as default, sanitize };\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,IAAI,SAASD,MAAM,CAAC;EACxB,OAAOE,QAAQ,GAAG,MAAM;EACxB,OAAOC,OAAO,GAAG,GAAG;EACpB,OAAOC,aAAa,GAAG,aAAa;EACpC,OAAOC,kBAAkB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC;EAErE,OAAOC,MAAMA,CAACC,KAAa,EAAE;IAC3B,MAAMC,IAAI,GAAG,KAAK,CAACF,MAAM,CAACC,KAAK,CAAgB;IAC/CC,IAAI,CAACC,YAAY,CAAC,MAAM,EAAE,IAAI,CAACC,QAAQ,CAACH,KAAK,CAAC,CAAC;IAC/CC,IAAI,CAACC,YAAY,CAAC,KAAK,EAAE,qBAAqB,CAAC;IAC/CD,IAAI,CAACC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACrC,OAAOD,IAAI;EACb;EAEA,OAAOG,OAAOA,CAACC,OAAoB,EAAE;IACnC,OAAOA,OAAO,CAACC,YAAY,CAAC,MAAM,CAAC;EACrC;EAEA,OAAOH,QAAQA,CAACI,GAAW,EAAE;IAC3B,OAAOJ,QAAQ,CAACI,GAAG,EAAE,IAAI,CAACT,kBAAkB,CAAC,GAAGS,GAAG,GAAG,IAAI,CAACV,aAAa;EAC1E;EAEAW,MAAMA,CAACC,IAAY,EAAET,KAAc,EAAE;IACnC,IAAIS,IAAI,KAAK,IAAI,CAACC,OAAO,CAACf,QAAQ,IAAI,CAACK,KAAK,EAAE;MAC5C,KAAK,CAACQ,MAAM,CAACC,IAAI,EAAET,KAAK,CAAC;IAC3B,CAAC,MAAM;MACL;MACA,IAAI,CAACK,OAAO,CAACH,YAAY,CAAC,MAAM,EAAE,IAAI,CAACS,WAAW,CAACR,QAAQ,CAACH,KAAK,CAAC,CAAC;IACrE;EACF;AACF;AAEA,SAASG,QAAQA,CAACI,GAAW,EAAEK,SAAmB,EAAE;EAClD,MAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,GAAG,CAAC;EAC1CF,MAAM,CAACG,IAAI,GAAGT,GAAG;EACjB,MAAMU,QAAQ,GAAGJ,MAAM,CAACG,IAAI,CAACE,KAAK,CAAC,CAAC,EAAEL,MAAM,CAACG,IAAI,CAACG,OAAO,CAAC,GAAG,CAAC,CAAC;EAC/D,OAAOP,SAAS,CAACO,OAAO,CAACF,QAAQ,CAAC,GAAG,CAAC,CAAC;AACzC;AAEA,SAASvB,IAAI,IAAI0B,OAAO,EAAEjB,QAAQ","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import Block from '../blots/block.js';
2
+ import Container from '../blots/container.js';
3
+ import type Scroll from '../blots/scroll.js';
4
+ declare class ListContainer extends Container {
5
+ }
6
+ declare class ListItem extends Block {
7
+ static create(value: string): HTMLElement;
8
+ static formats(domNode: HTMLElement): string | undefined;
9
+ static register(): void;
10
+ constructor(scroll: Scroll, domNode: HTMLElement);
11
+ format(name: string, value: string): void;
12
+ }
13
+ export { ListContainer, ListItem as default };
@@ -0,0 +1,50 @@
1
+ import Block from '../blots/block.js';
2
+ import Container from '../blots/container.js';
3
+ import Quill from '../core/quill.js';
4
+ class ListContainer extends Container {}
5
+ ListContainer.blotName = 'list-container';
6
+ ListContainer.tagName = 'OL';
7
+ class ListItem extends Block {
8
+ static create(value) {
9
+ const node = super.create();
10
+ node.setAttribute('data-list', value);
11
+ return node;
12
+ }
13
+ static formats(domNode) {
14
+ return domNode.getAttribute('data-list') || undefined;
15
+ }
16
+ static register() {
17
+ Quill.register(ListContainer);
18
+ }
19
+ constructor(scroll, domNode) {
20
+ super(scroll, domNode);
21
+ const ui = domNode.ownerDocument.createElement('span');
22
+ const listEventHandler = e => {
23
+ if (!scroll.isEnabled()) return;
24
+ const format = this.statics.formats(domNode, scroll);
25
+ if (format === 'checked') {
26
+ this.format('list', 'unchecked');
27
+ e.preventDefault();
28
+ } else if (format === 'unchecked') {
29
+ this.format('list', 'checked');
30
+ e.preventDefault();
31
+ }
32
+ };
33
+ ui.addEventListener('mousedown', listEventHandler);
34
+ ui.addEventListener('touchstart', listEventHandler);
35
+ this.attachUI(ui);
36
+ }
37
+ format(name, value) {
38
+ if (name === this.statics.blotName && value) {
39
+ this.domNode.setAttribute('data-list', value);
40
+ } else {
41
+ super.format(name, value);
42
+ }
43
+ }
44
+ }
45
+ ListItem.blotName = 'list';
46
+ ListItem.tagName = 'LI';
47
+ ListContainer.allowedChildren = [ListItem];
48
+ ListItem.requiredContainer = ListContainer;
49
+ export { ListContainer, ListItem as default };
50
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","names":["Block","Container","Quill","ListContainer","blotName","tagName","ListItem","create","value","node","setAttribute","formats","domNode","getAttribute","undefined","register","constructor","scroll","ui","ownerDocument","createElement","listEventHandler","e","isEnabled","format","statics","preventDefault","addEventListener","attachUI","name","allowedChildren","requiredContainer","default"],"sources":["../../src/formats/list.ts"],"sourcesContent":["import Block from '../blots/block.js';\nimport Container from '../blots/container.js';\nimport type Scroll from '../blots/scroll.js';\nimport Quill from '../core/quill.js';\n\nclass ListContainer extends Container {}\nListContainer.blotName = 'list-container';\nListContainer.tagName = 'OL';\n\nclass ListItem extends Block {\n static create(value: string) {\n const node = super.create() as HTMLElement;\n node.setAttribute('data-list', value);\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n return domNode.getAttribute('data-list') || undefined;\n }\n\n static register() {\n Quill.register(ListContainer);\n }\n\n constructor(scroll: Scroll, domNode: HTMLElement) {\n super(scroll, domNode);\n const ui = domNode.ownerDocument.createElement('span');\n const listEventHandler = (e: Event) => {\n if (!scroll.isEnabled()) return;\n const format = this.statics.formats(domNode, scroll);\n if (format === 'checked') {\n this.format('list', 'unchecked');\n e.preventDefault();\n } else if (format === 'unchecked') {\n this.format('list', 'checked');\n e.preventDefault();\n }\n };\n ui.addEventListener('mousedown', listEventHandler);\n ui.addEventListener('touchstart', listEventHandler);\n this.attachUI(ui);\n }\n\n format(name: string, value: string) {\n if (name === this.statics.blotName && value) {\n this.domNode.setAttribute('data-list', value);\n } else {\n super.format(name, value);\n }\n }\n}\nListItem.blotName = 'list';\nListItem.tagName = 'LI';\n\nListContainer.allowedChildren = [ListItem];\nListItem.requiredContainer = ListContainer;\n\nexport { ListContainer, ListItem as default };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AACrC,OAAOC,SAAS,MAAM,uBAAuB;AAE7C,OAAOC,KAAK,MAAM,kBAAkB;AAEpC,MAAMC,aAAa,SAASF,SAAS,CAAC;AACtCE,aAAa,CAACC,QAAQ,GAAG,gBAAgB;AACzCD,aAAa,CAACE,OAAO,GAAG,IAAI;AAE5B,MAAMC,QAAQ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KAAa,EAAE;IAClC,IAAIqB,IAAI,KAAK,IAAI,CAACJ,OAAO,CAACrB,QAAQ,IAAII,KAAK,EAAE;MAC3C,IAAI,CAACI,OAAO,CAACF,YAAY,CAAC,WAAW,EAAEF,KAAK,CAAC;IAC/C,CAAC,MAAM;MACL,KAAK,CAACgB,MAAM,CAACK,IAAI,EAAErB,KAAK,CAAC;IAC3B;EACF;AACF;AACAF,QAAQ,CAACF,QAAQ,GAAG,MAAM;AAC1BE,QAAQ,CAACD,OAAO,GAAG,IAAI;AAEvBF,aAAa,CAAC2B,eAAe,GAAG,CAACxB,QAAQ,CAAC;AAC1CA,QAAQ,CAACyB,iBAAiB,GAAG5B,aAAa;AAE1C,SAASA,aAAa,EAAEG,QAAQ,IAAI0B,OAAO","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import Inline from '../blots/inline.js';
2
+ declare class Script extends Inline {
3
+ static blotName: string;
4
+ static tagName: string[];
5
+ static create(value: 'super' | 'sub' | (string & {})): HTMLElement;
6
+ static formats(domNode: HTMLElement): "super" | "sub" | undefined;
7
+ }
8
+ export default Script;
@@ -0,0 +1,21 @@
1
+ import Inline from '../blots/inline.js';
2
+ class Script extends Inline {
3
+ static blotName = 'script';
4
+ static tagName = ['SUB', 'SUP'];
5
+ static create(value) {
6
+ if (value === 'super') {
7
+ return document.createElement('sup');
8
+ }
9
+ if (value === 'sub') {
10
+ return document.createElement('sub');
11
+ }
12
+ return super.create(value);
13
+ }
14
+ static formats(domNode) {
15
+ if (domNode.tagName === 'SUB') return 'sub';
16
+ if (domNode.tagName === 'SUP') return 'super';
17
+ return undefined;
18
+ }
19
+ }
20
+ export default Script;
21
+ //# sourceMappingURL=script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.js","names":["Inline","Script","blotName","tagName","create","value","document","createElement","formats","domNode","undefined"],"sources":["../../src/formats/script.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Script extends Inline {\n static blotName = 'script';\n static tagName = ['SUB', 'SUP'];\n\n static create(value: 'super' | 'sub' | (string & {})) {\n if (value === 'super') {\n return document.createElement('sup');\n }\n if (value === 'sub') {\n return document.createElement('sub');\n }\n return super.create(value);\n }\n\n static formats(domNode: HTMLElement) {\n if (domNode.tagName === 'SUB') return 'sub';\n if (domNode.tagName === 'SUP') return 'super';\n return undefined;\n }\n}\n\nexport default Script;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,MAAM,SAASD,MAAM,CAAC;EAC1B,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC;EAE/B,OAAOC,MAAMA,CAACC,KAAsC,EAAE;IACpD,IAAIA,KAAK,KAAK,OAAO,EAAE;MACrB,OAAOC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IACtC;IACA,IAAIF,KAAK,KAAK,KAAK,EAAE;MACnB,OAAOC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IACtC;IACA,OAAO,KAAK,CAACH,MAAM,CAACC,KAAK,CAAC;EAC5B;EAEA,OAAOG,OAAOA,CAACC,OAAoB,EAAE;IACnC,IAAIA,OAAO,CAACN,OAAO,KAAK,KAAK,EAAE,OAAO,KAAK;IAC3C,IAAIM,OAAO,CAACN,OAAO,KAAK,KAAK,EAAE,OAAO,OAAO;IAC7C,OAAOO,SAAS;EAClB;AACF;AAEA,eAAeT,MAAM","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import { ClassAttributor, StyleAttributor } from 'parchment';
2
+ declare const SizeClass: ClassAttributor;
3
+ declare const SizeStyle: StyleAttributor;
4
+ export { SizeClass, SizeStyle };
@@ -0,0 +1,11 @@
1
+ import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
2
+ const SizeClass = new ClassAttributor('size', 'ql-size', {
3
+ scope: Scope.INLINE,
4
+ whitelist: ['small', 'large', 'huge']
5
+ });
6
+ const SizeStyle = new StyleAttributor('size', 'font-size', {
7
+ scope: Scope.INLINE,
8
+ whitelist: ['10px', '18px', '32px']
9
+ });
10
+ export { SizeClass, SizeStyle };
11
+ //# sourceMappingURL=size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.js","names":["ClassAttributor","Scope","StyleAttributor","SizeClass","scope","INLINE","whitelist","SizeStyle"],"sources":["../../src/formats/size.ts"],"sourcesContent":["import { ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nconst SizeClass = new ClassAttributor('size', 'ql-size', {\n scope: Scope.INLINE,\n whitelist: ['small', 'large', 'huge'],\n});\nconst SizeStyle = new StyleAttributor('size', 'font-size', {\n scope: Scope.INLINE,\n whitelist: ['10px', '18px', '32px'],\n});\n\nexport { SizeClass, SizeStyle };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAEnE,MAAMC,SAAS,GAAG,IAAIH,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE;EACvDI,KAAK,EAAEH,KAAK,CAACI,MAAM;EACnBC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM;AACtC,CAAC,CAAC;AACF,MAAMC,SAAS,GAAG,IAAIL,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE;EACzDE,KAAK,EAAEH,KAAK,CAACI,MAAM;EACnBC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;AACpC,CAAC,CAAC;AAEF,SAASH,SAAS,EAAEI,SAAS","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import Bold from './bold.js';
2
+ declare class Strike extends Bold {
3
+ static blotName: string;
4
+ static tagName: string[];
5
+ }
6
+ export default Strike;
@@ -0,0 +1,7 @@
1
+ import Bold from './bold.js';
2
+ class Strike extends Bold {
3
+ static blotName = 'strike';
4
+ static tagName = ['S', 'STRIKE'];
5
+ }
6
+ export default Strike;
7
+ //# sourceMappingURL=strike.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strike.js","names":["Bold","Strike","blotName","tagName"],"sources":["../../src/formats/strike.ts"],"sourcesContent":["import Bold from './bold.js';\n\nclass Strike extends Bold {\n static blotName = 'strike';\n static tagName = ['S', 'STRIKE'];\n}\n\nexport default Strike;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,WAAW;AAE5B,MAAMC,MAAM,SAASD,IAAI,CAAC;EACxB,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC;AAClC;AAEA,eAAeF,MAAM","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ import type { LinkedList } from 'parchment';
2
+ import Block from '../blots/block.js';
3
+ import Container from '../blots/container.js';
4
+ declare class TableCell extends Block {
5
+ static blotName: string;
6
+ static tagName: string;
7
+ static create(value: string): HTMLElement;
8
+ static formats(domNode: HTMLElement): string | null | undefined;
9
+ next: this | null;
10
+ cellOffset(): number;
11
+ format(name: string, value: string): void;
12
+ row(): TableRow;
13
+ rowOffset(): number;
14
+ table(): import("parchment").Parent;
15
+ }
16
+ declare class TableRow extends Container {
17
+ static blotName: string;
18
+ static tagName: string;
19
+ children: LinkedList<TableCell>;
20
+ next: this | null;
21
+ checkMerge(): boolean;
22
+ optimize(context: {
23
+ [key: string]: any;
24
+ }): void;
25
+ rowOffset(): number;
26
+ table(): import("parchment").Parent;
27
+ }
28
+ declare class TableBody extends Container {
29
+ static blotName: string;
30
+ static tagName: string;
31
+ children: LinkedList<TableRow>;
32
+ }
33
+ declare class TableContainer extends Container {
34
+ static blotName: string;
35
+ static tagName: string;
36
+ children: LinkedList<TableBody>;
37
+ balanceCells(): void;
38
+ cells(column: number): any[];
39
+ deleteColumn(index: number): void;
40
+ insertColumn(index: number): void;
41
+ insertRow(index: number): void;
42
+ rows(): any[];
43
+ }
44
+ declare function tableId(): string;
45
+ export { TableCell, TableRow, TableBody, TableContainer, tableId };
@@ -0,0 +1,176 @@
1
+ import Block from '../blots/block.js';
2
+ import Container from '../blots/container.js';
3
+ class TableCell extends Block {
4
+ static blotName = 'table';
5
+ static tagName = 'TD';
6
+ static create(value) {
7
+ const node = super.create();
8
+ if (value) {
9
+ node.setAttribute('data-row', value);
10
+ } else {
11
+ node.setAttribute('data-row', tableId());
12
+ }
13
+ return node;
14
+ }
15
+ static formats(domNode) {
16
+ if (domNode.hasAttribute('data-row')) {
17
+ return domNode.getAttribute('data-row');
18
+ }
19
+ return undefined;
20
+ }
21
+ cellOffset() {
22
+ if (this.parent) {
23
+ return this.parent.children.indexOf(this);
24
+ }
25
+ return -1;
26
+ }
27
+ format(name, value) {
28
+ if (name === TableCell.blotName && value) {
29
+ this.domNode.setAttribute('data-row', value);
30
+ } else {
31
+ super.format(name, value);
32
+ }
33
+ }
34
+ row() {
35
+ return this.parent;
36
+ }
37
+ rowOffset() {
38
+ if (this.row()) {
39
+ return this.row().rowOffset();
40
+ }
41
+ return -1;
42
+ }
43
+ table() {
44
+ return this.row() && this.row().table();
45
+ }
46
+ }
47
+ class TableRow extends Container {
48
+ static blotName = 'table-row';
49
+ static tagName = 'TR';
50
+ checkMerge() {
51
+ // @ts-expect-error
52
+ if (super.checkMerge() && this.next.children.head != null) {
53
+ // @ts-expect-error
54
+ const thisHead = this.children.head.formats();
55
+ // @ts-expect-error
56
+ const thisTail = this.children.tail.formats();
57
+ // @ts-expect-error
58
+ const nextHead = this.next.children.head.formats();
59
+ // @ts-expect-error
60
+ const nextTail = this.next.children.tail.formats();
61
+ return thisHead.table === thisTail.table && thisHead.table === nextHead.table && thisHead.table === nextTail.table;
62
+ }
63
+ return false;
64
+ }
65
+ optimize(context) {
66
+ super.optimize(context);
67
+ this.children.forEach(child => {
68
+ if (child.next == null) return;
69
+ const childFormats = child.formats();
70
+ const nextFormats = child.next.formats();
71
+ if (childFormats.table !== nextFormats.table) {
72
+ const next = this.splitAfter(child);
73
+ if (next) {
74
+ // @ts-expect-error TODO: parameters of optimize() should be a optional
75
+ next.optimize();
76
+ }
77
+ // We might be able to merge with prev now
78
+ if (this.prev) {
79
+ // @ts-expect-error TODO: parameters of optimize() should be a optional
80
+ this.prev.optimize();
81
+ }
82
+ }
83
+ });
84
+ }
85
+ rowOffset() {
86
+ if (this.parent) {
87
+ return this.parent.children.indexOf(this);
88
+ }
89
+ return -1;
90
+ }
91
+ table() {
92
+ return this.parent && this.parent.parent;
93
+ }
94
+ }
95
+ class TableBody extends Container {
96
+ static blotName = 'table-body';
97
+ static tagName = 'TBODY';
98
+ }
99
+ class TableContainer extends Container {
100
+ static blotName = 'table-container';
101
+ static tagName = 'TABLE';
102
+ balanceCells() {
103
+ const rows = this.descendants(TableRow);
104
+ const maxColumns = rows.reduce((max, row) => {
105
+ return Math.max(row.children.length, max);
106
+ }, 0);
107
+ rows.forEach(row => {
108
+ new Array(maxColumns - row.children.length).fill(0).forEach(() => {
109
+ let value;
110
+ if (row.children.head != null) {
111
+ value = TableCell.formats(row.children.head.domNode);
112
+ }
113
+ const blot = this.scroll.create(TableCell.blotName, value);
114
+ row.appendChild(blot);
115
+ // @ts-expect-error TODO: parameters of optimize() should be a optional
116
+ blot.optimize(); // Add break blot
117
+ });
118
+ });
119
+ }
120
+ cells(column) {
121
+ return this.rows().map(row => row.children.at(column));
122
+ }
123
+ deleteColumn(index) {
124
+ // @ts-expect-error
125
+ const [body] = this.descendant(TableBody);
126
+ if (body == null || body.children.head == null) return;
127
+ body.children.forEach(row => {
128
+ const cell = row.children.at(index);
129
+ if (cell != null) {
130
+ cell.remove();
131
+ }
132
+ });
133
+ }
134
+ insertColumn(index) {
135
+ // @ts-expect-error
136
+ const [body] = this.descendant(TableBody);
137
+ if (body == null || body.children.head == null) return;
138
+ body.children.forEach(row => {
139
+ const ref = row.children.at(index);
140
+ // @ts-expect-error
141
+ const value = TableCell.formats(row.children.head.domNode);
142
+ const cell = this.scroll.create(TableCell.blotName, value);
143
+ row.insertBefore(cell, ref);
144
+ });
145
+ }
146
+ insertRow(index) {
147
+ // @ts-expect-error
148
+ const [body] = this.descendant(TableBody);
149
+ if (body == null || body.children.head == null) return;
150
+ const id = tableId();
151
+ const row = this.scroll.create(TableRow.blotName);
152
+ body.children.head.children.forEach(() => {
153
+ const cell = this.scroll.create(TableCell.blotName, id);
154
+ row.appendChild(cell);
155
+ });
156
+ const ref = body.children.at(index);
157
+ body.insertBefore(row, ref);
158
+ }
159
+ rows() {
160
+ const body = this.children.head;
161
+ if (body == null) return [];
162
+ return body.children.map(row => row);
163
+ }
164
+ }
165
+ TableContainer.allowedChildren = [TableBody];
166
+ TableBody.requiredContainer = TableContainer;
167
+ TableBody.allowedChildren = [TableRow];
168
+ TableRow.requiredContainer = TableBody;
169
+ TableRow.allowedChildren = [TableCell];
170
+ TableCell.requiredContainer = TableRow;
171
+ function tableId() {
172
+ const id = Math.random().toString(36).slice(2, 6);
173
+ return `row-${id}`;
174
+ }
175
+ export { TableCell, TableRow, TableBody, TableContainer, tableId };
176
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","names":["Block","Container","TableCell","blotName","tagName","create","value","node","setAttribute","tableId","formats","domNode","hasAttribute","getAttribute","undefined","cellOffset","parent","children","indexOf","format","name","row","rowOffset","table","TableRow","checkMerge","next","head","thisHead","thisTail","tail","nextHead","nextTail","optimize","context","forEach","child","childFormats","nextFormats","splitAfter","prev","TableBody","TableContainer","balanceCells","rows","descendants","maxColumns","reduce","max","Math","length","Array","fill","blot","scroll","appendChild","cells","column","map","at","deleteColumn","index","body","descendant","cell","remove","insertColumn","ref","insertBefore","insertRow","id","allowedChildren","requiredContainer","random","toString","slice"],"sources":["../../src/formats/table.ts"],"sourcesContent":["import type { LinkedList } from 'parchment';\nimport Block from '../blots/block.js';\nimport Container from '../blots/container.js';\n\nclass TableCell extends Block {\n static blotName = 'table';\n static tagName = 'TD';\n\n static create(value: string) {\n const node = super.create() as HTMLElement;\n if (value) {\n node.setAttribute('data-row', value);\n } else {\n node.setAttribute('data-row', tableId());\n }\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n if (domNode.hasAttribute('data-row')) {\n return domNode.getAttribute('data-row');\n }\n return undefined;\n }\n\n next: this | null;\n\n cellOffset() {\n if (this.parent) {\n return this.parent.children.indexOf(this);\n }\n return -1;\n }\n\n format(name: string, value: string) {\n if (name === TableCell.blotName && value) {\n this.domNode.setAttribute('data-row', value);\n } else {\n super.format(name, value);\n }\n }\n\n row(): TableRow {\n return this.parent as TableRow;\n }\n\n rowOffset() {\n if (this.row()) {\n return this.row().rowOffset();\n }\n return -1;\n }\n\n table() {\n return this.row() && this.row().table();\n }\n}\n\nclass TableRow extends Container {\n static blotName = 'table-row';\n static tagName = 'TR';\n\n children: LinkedList<TableCell>;\n next: this | null;\n\n checkMerge() {\n // @ts-expect-error\n if (super.checkMerge() && this.next.children.head != null) {\n // @ts-expect-error\n const thisHead = this.children.head.formats();\n // @ts-expect-error\n const thisTail = this.children.tail.formats();\n // @ts-expect-error\n const nextHead = this.next.children.head.formats();\n // @ts-expect-error\n const nextTail = this.next.children.tail.formats();\n return (\n thisHead.table === thisTail.table &&\n thisHead.table === nextHead.table &&\n thisHead.table === nextTail.table\n );\n }\n return false;\n }\n\n optimize(context: { [key: string]: any }) {\n super.optimize(context);\n this.children.forEach((child) => {\n if (child.next == null) return;\n const childFormats = child.formats();\n const nextFormats = child.next.formats();\n if (childFormats.table !== nextFormats.table) {\n const next = this.splitAfter(child);\n if (next) {\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n next.optimize();\n }\n // We might be able to merge with prev now\n if (this.prev) {\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n this.prev.optimize();\n }\n }\n });\n }\n\n rowOffset() {\n if (this.parent) {\n return this.parent.children.indexOf(this);\n }\n return -1;\n }\n\n table() {\n return this.parent && this.parent.parent;\n }\n}\n\nclass TableBody extends Container {\n static blotName = 'table-body';\n static tagName = 'TBODY';\n\n children: LinkedList<TableRow>;\n}\n\nclass TableContainer extends Container {\n static blotName = 'table-container';\n static tagName = 'TABLE';\n\n children: LinkedList<TableBody>;\n\n balanceCells() {\n const rows = this.descendants(TableRow);\n const maxColumns = rows.reduce((max, row) => {\n return Math.max(row.children.length, max);\n }, 0);\n rows.forEach((row) => {\n new Array(maxColumns - row.children.length).fill(0).forEach(() => {\n let value;\n if (row.children.head != null) {\n value = TableCell.formats(row.children.head.domNode);\n }\n const blot = this.scroll.create(TableCell.blotName, value);\n row.appendChild(blot);\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n blot.optimize(); // Add break blot\n });\n });\n }\n\n cells(column: number) {\n return this.rows().map((row) => row.children.at(column));\n }\n\n deleteColumn(index: number) {\n // @ts-expect-error\n const [body] = this.descendant(TableBody) as TableBody[];\n if (body == null || body.children.head == null) return;\n body.children.forEach((row) => {\n const cell = row.children.at(index);\n if (cell != null) {\n cell.remove();\n }\n });\n }\n\n insertColumn(index: number) {\n // @ts-expect-error\n const [body] = this.descendant(TableBody) as TableBody[];\n if (body == null || body.children.head == null) return;\n body.children.forEach((row) => {\n const ref = row.children.at(index);\n // @ts-expect-error\n const value = TableCell.formats(row.children.head.domNode);\n const cell = this.scroll.create(TableCell.blotName, value);\n row.insertBefore(cell, ref);\n });\n }\n\n insertRow(index: number) {\n // @ts-expect-error\n const [body] = this.descendant(TableBody) as TableBody[];\n if (body == null || body.children.head == null) return;\n const id = tableId();\n const row = this.scroll.create(TableRow.blotName) as TableRow;\n body.children.head.children.forEach(() => {\n const cell = this.scroll.create(TableCell.blotName, id);\n row.appendChild(cell);\n });\n const ref = body.children.at(index);\n body.insertBefore(row, ref);\n }\n\n rows() {\n const body = this.children.head;\n if (body == null) return [];\n return body.children.map((row) => row);\n }\n}\n\nTableContainer.allowedChildren = [TableBody];\nTableBody.requiredContainer = TableContainer;\n\nTableBody.allowedChildren = [TableRow];\nTableRow.requiredContainer = TableBody;\n\nTableRow.allowedChildren = [TableCell];\nTableCell.requiredContainer = TableRow;\n\nfunction tableId() {\n const id = Math.random().toString(36).slice(2, 6);\n return `row-${id}`;\n}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E,CAAC;MACvDjD,GAAG,CAACkC,WAAW,CAACS,IAAI,CAAC;IACvB,CAAC,CAAC;IACF,MAAMG,GAAG,GAAGL,IAAI,CAAC7C,QAAQ,CAAC0C,EAAE,CAACE,KAAK,CAAC;IACnCC,IAAI,CAACM,YAAY,CAAC/C,GAAG,EAAE8C,GAAG,CAAC;EAC7B;EAEAvB,IAAIA,CAAA,EAAG;IACL,MAAMkB,IAAI,GAAG,IAAI,CAAC7C,QAAQ,CAACU,IAAI;IAC/B,IAAImC,IAAI,IAAI,IAAI,EAAE,OAAO,EAAE;IAC3B,OAAOA,IAAI,CAAC7C,QAAQ,CAACyC,GAAG,CAAErC,GAAG,IAAKA,GAAG,CAAC;EACxC;AACF;AAEAqB,cAAc,CAAC6B,eAAe,GAAG,CAAC9B,SAAS,CAAC;AAC5CA,SAAS,CAAC+B,iBAAiB,GAAG9B,cAAc;AAE5CD,SAAS,CAAC8B,eAAe,GAAG,CAAC/C,QAAQ,CAAC;AACtCA,QAAQ,CAACgD,iBAAiB,GAAG/B,SAAS;AAEtCjB,QAAQ,CAAC+C,eAAe,GAAG,CAACrE,SAAS,CAAC;AACtCA,SAAS,CAACsE,iBAAiB,GAAGhD,QAAQ;AAEtC,SAASf,OAAOA,CAAA,EAAG;EACjB,MAAM6D,EAAE,GAAGrB,IAAI,CAACwB,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;EACjD,OAAQ,OAAML,EAAG,EAAC;AACpB;AAEA,SAASpE,SAAS,EAAEsB,QAAQ,EAAEiB,SAAS,EAAEC,cAAc,EAAEjC,OAAO","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import Inline from '../blots/inline.js';
2
+ declare class Underline extends Inline {
3
+ static blotName: string;
4
+ static tagName: string;
5
+ }
6
+ export default Underline;
@@ -0,0 +1,7 @@
1
+ import Inline from '../blots/inline.js';
2
+ class Underline extends Inline {
3
+ static blotName = 'underline';
4
+ static tagName = 'U';
5
+ }
6
+ export default Underline;
7
+ //# sourceMappingURL=underline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"underline.js","names":["Inline","Underline","blotName","tagName"],"sources":["../../src/formats/underline.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Underline extends Inline {\n static blotName = 'underline';\n static tagName = 'U';\n}\n\nexport default Underline;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,SAAS,SAASD,MAAM,CAAC;EAC7B,OAAOE,QAAQ,GAAG,WAAW;EAC7B,OAAOC,OAAO,GAAG,GAAG;AACtB;AAEA,eAAeF,SAAS","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import { BlockEmbed } from '../blots/block.js';
2
+ declare class Video extends BlockEmbed {
3
+ static blotName: string;
4
+ static className: string;
5
+ static tagName: string;
6
+ static create(value: string): Element;
7
+ static formats(domNode: Element): Record<string, string | null>;
8
+ static sanitize(url: string): string;
9
+ static value(domNode: Element): string | null;
10
+ domNode: HTMLVideoElement;
11
+ format(name: string, value: string): void;
12
+ html(): string;
13
+ }
14
+ export default Video;
@@ -0,0 +1,49 @@
1
+ import { BlockEmbed } from '../blots/block.js';
2
+ import Link from './link.js';
3
+ import { escapeText } from '../blots/text.js';
4
+ const ATTRIBUTES = ['height', 'width'];
5
+ class Video extends BlockEmbed {
6
+ static blotName = 'video';
7
+ static className = 'ql-video';
8
+ static tagName = 'IFRAME';
9
+ static create(value) {
10
+ const node = super.create(value);
11
+ node.setAttribute('frameborder', '0');
12
+ node.setAttribute('allowfullscreen', 'true');
13
+ node.setAttribute('src', this.sanitize(value));
14
+ return node;
15
+ }
16
+ static formats(domNode) {
17
+ return ATTRIBUTES.reduce((formats, attribute) => {
18
+ if (domNode.hasAttribute(attribute)) {
19
+ formats[attribute] = domNode.getAttribute(attribute);
20
+ }
21
+ return formats;
22
+ }, {});
23
+ }
24
+ static sanitize(url) {
25
+ return Link.sanitize(url);
26
+ }
27
+ static value(domNode) {
28
+ return domNode.getAttribute('src');
29
+ }
30
+ format(name, value) {
31
+ if (ATTRIBUTES.indexOf(name) > -1) {
32
+ if (value) {
33
+ this.domNode.setAttribute(name, value);
34
+ } else {
35
+ this.domNode.removeAttribute(name);
36
+ }
37
+ } else {
38
+ super.format(name, value);
39
+ }
40
+ }
41
+ html() {
42
+ const {
43
+ video
44
+ } = this.value();
45
+ return `<a href="${escapeText(video)}">${escapeText(video)}</a>`;
46
+ }
47
+ }
48
+ export default Video;
49
+ //# sourceMappingURL=video.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.js","names":["BlockEmbed","Link","escapeText","ATTRIBUTES","Video","blotName","className","tagName","create","value","node","setAttribute","sanitize","formats","domNode","reduce","attribute","hasAttribute","getAttribute","url","format","name","indexOf","removeAttribute","html","video"],"sources":["../../src/formats/video.ts"],"sourcesContent":["import { BlockEmbed } from '../blots/block.js';\nimport Link from './link.js';\nimport { escapeText } from '../blots/text.js';\n\nconst ATTRIBUTES = ['height', 'width'];\n\nclass Video extends BlockEmbed {\n static blotName = 'video';\n static className = 'ql-video';\n static tagName = 'IFRAME';\n\n static create(value: string) {\n const node = super.create(value) as Element;\n node.setAttribute('frameborder', '0');\n node.setAttribute('allowfullscreen', 'true');\n node.setAttribute('src', this.sanitize(value));\n return node;\n }\n\n static formats(domNode: Element) {\n return ATTRIBUTES.reduce(\n (formats: Record<string, string | null>, attribute) => {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n },\n {},\n );\n }\n\n static sanitize(url: string) {\n return Link.sanitize(url);\n }\n\n static value(domNode: Element) {\n return domNode.getAttribute('src');\n }\n\n domNode: HTMLVideoElement;\n\n format(name: string, value: string) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n super.format(name, value);\n }\n }\n\n html() {\n const { video } = this.value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,KAAa,EAAE;IAClC,IAAIN,UAAU,CAACmB,OAAO,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;MACjC,IAAIZ,KAAK,EAAE;QACT,IAAI,CAACK,OAAO,CAACH,YAAY,CAACU,IAAI,EAAEZ,KAAK,CAAC;MACxC,CAAC,MAAM;QACL,IAAI,CAACK,OAAO,CAACS,eAAe,CAACF,IAAI,CAAC;MACpC;IACF,CAAC,MAAM;MACL,KAAK,CAACD,MAAM,CAACC,IAAI,EAAEZ,KAAK,CAAC;IAC3B;EACF;EAEAe,IAAIA,CAAA,EAAG;IACL,MAAM;MAAEC;IAAM,CAAC,GAAG,IAAI,CAAChB,KAAK,CAAC,CAAC;IAC9B,OAAQ,YAAWP,UAAU,CAACuB,KAAK,CAAE,KAAIvB,UAAU,CAACuB,KAAK,CAAE,MAAK;EAClE;AACF;AAEA,eAAerB,KAAK","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ import type { ScrollBlot } from 'parchment';
2
+ import Delta from 'quill-delta';
3
+ import type { EmitterSource } from '../core/emitter.js';
4
+ import Module from '../core/module.js';
5
+ import Quill from '../core/quill.js';
6
+ import type { Range } from '../core/selection.js';
7
+ type Selector = string | Node['TEXT_NODE'] | Node['ELEMENT_NODE'];
8
+ type Matcher = (node: Node, delta: Delta, scroll: ScrollBlot) => Delta;
9
+ interface ClipboardOptions {
10
+ matchers: [Selector, Matcher][];
11
+ }
12
+ declare class Clipboard extends Module<ClipboardOptions> {
13
+ static DEFAULTS: ClipboardOptions;
14
+ matchers: [Selector, Matcher][];
15
+ constructor(quill: Quill, options: Partial<ClipboardOptions>);
16
+ addMatcher(selector: Selector, matcher: Matcher): void;
17
+ convert({ html, text }: {
18
+ html?: string;
19
+ text?: string;
20
+ }, formats?: Record<string, unknown>): Delta;
21
+ protected normalizeHTML(doc: Document): void;
22
+ protected convertHTML(html: string): Delta;
23
+ dangerouslyPasteHTML(html: string, source?: EmitterSource): void;
24
+ dangerouslyPasteHTML(index: number, html: string, source?: EmitterSource): void;
25
+ onCaptureCopy(e: ClipboardEvent, isCut?: boolean): void;
26
+ private normalizeURIList;
27
+ onCapturePaste(e: ClipboardEvent): void;
28
+ onCopy(range: Range, isCut: boolean): {
29
+ html: string;
30
+ text: string;
31
+ };
32
+ onPaste(range: Range, { text, html }: {
33
+ text?: string;
34
+ html?: string;
35
+ }): void;
36
+ prepareMatching(container: Element, nodeMatches: WeakMap<Node, Matcher[]>): Matcher[][];
37
+ }
38
+ declare function traverse(scroll: ScrollBlot, node: ChildNode, elementMatchers: Matcher[], textMatchers: Matcher[], nodeMatches: WeakMap<Node, Matcher[]>): Delta;
39
+ declare function matchAttributor(node: HTMLElement, delta: Delta, scroll: ScrollBlot): Delta;
40
+ declare function matchBlot(node: Node, delta: Delta, scroll: ScrollBlot): Delta;
41
+ declare function matchNewline(node: Node, delta: Delta, scroll: ScrollBlot): Delta;
42
+ declare function matchText(node: HTMLElement, delta: Delta, scroll: ScrollBlot): Delta;
43
+ export { Clipboard as default, matchAttributor, matchBlot, matchNewline, matchText, traverse, };