@plotdb/quill 1.0.0 → 1.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 (291) hide show
  1. package/babel.config.cjs +12 -0
  2. package/package.json +2 -1
  3. package/scripts/babel-svg-inline-import.cjs +44 -0
  4. package/scripts/build +20 -0
  5. package/src/types.d.ts +6 -0
  6. package/webpack.common.cjs +69 -0
  7. package/webpack.config.cjs +42 -0
  8. package/blots/block.d.ts +0 -34
  9. package/blots/block.js +0 -182
  10. package/blots/block.js.map +0 -1
  11. package/blots/break.d.ts +0 -8
  12. package/blots/break.js +0 -21
  13. package/blots/break.js.map +0 -1
  14. package/blots/container.d.ts +0 -4
  15. package/blots/container.js +0 -4
  16. package/blots/container.js.map +0 -1
  17. package/blots/cursor.d.ts +0 -26
  18. package/blots/cursor.js +0 -170
  19. package/blots/cursor.js.map +0 -1
  20. package/blots/embed.d.ts +0 -18
  21. package/blots/embed.js +0 -72
  22. package/blots/embed.js.map +0 -1
  23. package/blots/inline.d.ts +0 -12
  24. package/blots/inline.js +0 -48
  25. package/blots/inline.js.map +0 -1
  26. package/blots/scroll.d.ts +0 -49
  27. package/blots/scroll.js +0 -349
  28. package/blots/scroll.js.map +0 -1
  29. package/blots/text.d.ts +0 -5
  30. package/blots/text.js +0 -16
  31. package/blots/text.js.map +0 -1
  32. package/core/composition.d.ts +0 -12
  33. package/core/composition.js +0 -44
  34. package/core/composition.js.map +0 -1
  35. package/core/editor.d.ts +0 -28
  36. package/core/editor.js +0 -404
  37. package/core/editor.js.map +0 -1
  38. package/core/emitter.d.ts +0 -33
  39. package/core/emitter.js +0 -78
  40. package/core/emitter.js.map +0 -1
  41. package/core/instances.d.ts +0 -3
  42. package/core/instances.js +0 -2
  43. package/core/instances.js.map +0 -1
  44. package/core/logger.d.ts +0 -7
  45. package/core/logger.js +0 -24
  46. package/core/logger.js.map +0 -1
  47. package/core/module.d.ts +0 -8
  48. package/core/module.js +0 -10
  49. package/core/module.js.map +0 -1
  50. package/core/quill.d.ts +0 -218
  51. package/core/quill.js +0 -630
  52. package/core/quill.js.map +0 -1
  53. package/core/selection.d.ts +0 -74
  54. package/core/selection.js +0 -374
  55. package/core/selection.js.map +0 -1
  56. package/core/theme.d.ts +0 -32
  57. package/core/theme.js +0 -28
  58. package/core/theme.js.map +0 -1
  59. package/core/utils/createRegistryWithFormats.d.ts +0 -5
  60. package/core/utils/createRegistryWithFormats.js +0 -29
  61. package/core/utils/createRegistryWithFormats.js.map +0 -1
  62. package/core/utils/scrollRectIntoView.d.ts +0 -11
  63. package/core/utils/scrollRectIntoView.js +0 -110
  64. package/core/utils/scrollRectIntoView.js.map +0 -1
  65. package/core.d.ts +0 -7
  66. package/core.js +0 -37
  67. package/core.js.map +0 -1
  68. package/dist/quill.bubble.css +0 -10
  69. package/dist/quill.bubble.css.map +0 -1
  70. package/dist/quill.core.css +0 -10
  71. package/dist/quill.core.css.map +0 -1
  72. package/dist/quill.core.js +0 -3
  73. package/dist/quill.core.js.LICENSE.txt +0 -7
  74. package/dist/quill.core.js.map +0 -1
  75. package/dist/quill.js +0 -3
  76. package/dist/quill.js.LICENSE.txt +0 -7
  77. package/dist/quill.js.map +0 -1
  78. package/dist/quill.snow.css +0 -10
  79. package/dist/quill.snow.css.map +0 -1
  80. package/formats/align.d.ts +0 -5
  81. package/formats/align.js +0 -10
  82. package/formats/align.js.map +0 -1
  83. package/formats/background.d.ts +0 -5
  84. package/formats/background.js +0 -10
  85. package/formats/background.js.map +0 -1
  86. package/formats/blockquote.d.ts +0 -6
  87. package/formats/blockquote.js +0 -7
  88. package/formats/blockquote.js.map +0 -1
  89. package/formats/bold.d.ts +0 -11
  90. package/formats/bold.js +0 -19
  91. package/formats/bold.js.map +0 -1
  92. package/formats/code.d.ts +0 -15
  93. package/formats/code.js +0 -44
  94. package/formats/code.js.map +0 -1
  95. package/formats/color.d.ts +0 -7
  96. package/formats/color.js +0 -18
  97. package/formats/color.js.map +0 -1
  98. package/formats/direction.d.ts +0 -5
  99. package/formats/direction.js +0 -10
  100. package/formats/direction.js.map +0 -1
  101. package/formats/font.d.ts +0 -7
  102. package/formats/font.js +0 -14
  103. package/formats/font.js.map +0 -1
  104. package/formats/formula.d.ts +0 -10
  105. package/formats/formula.js +0 -34
  106. package/formats/formula.js.map +0 -1
  107. package/formats/header.d.ts +0 -7
  108. package/formats/header.js +0 -10
  109. package/formats/header.js.map +0 -1
  110. package/formats/image.d.ts +0 -13
  111. package/formats/image.js +0 -44
  112. package/formats/image.js.map +0 -1
  113. package/formats/indent.d.ts +0 -8
  114. package/formats/indent.js +0 -30
  115. package/formats/indent.js.map +0 -1
  116. package/formats/italic.d.ts +0 -6
  117. package/formats/italic.js +0 -7
  118. package/formats/italic.js.map +0 -1
  119. package/formats/link.d.ts +0 -13
  120. package/formats/link.js +0 -36
  121. package/formats/link.js.map +0 -1
  122. package/formats/list.d.ts +0 -13
  123. package/formats/list.js +0 -50
  124. package/formats/list.js.map +0 -1
  125. package/formats/script.d.ts +0 -8
  126. package/formats/script.js +0 -21
  127. package/formats/script.js.map +0 -1
  128. package/formats/size.d.ts +0 -4
  129. package/formats/size.js +0 -11
  130. package/formats/size.js.map +0 -1
  131. package/formats/strike.d.ts +0 -6
  132. package/formats/strike.js +0 -7
  133. package/formats/strike.js.map +0 -1
  134. package/formats/table.d.ts +0 -45
  135. package/formats/table.js +0 -176
  136. package/formats/table.js.map +0 -1
  137. package/formats/underline.d.ts +0 -6
  138. package/formats/underline.js +0 -7
  139. package/formats/underline.js.map +0 -1
  140. package/formats/video.d.ts +0 -14
  141. package/formats/video.js +0 -49
  142. package/formats/video.js.map +0 -1
  143. package/modules/clipboard.d.ts +0 -43
  144. package/modules/clipboard.js +0 -477
  145. package/modules/clipboard.js.map +0 -1
  146. package/modules/history.d.ts +0 -36
  147. package/modules/history.js +0 -178
  148. package/modules/history.js.map +0 -1
  149. package/modules/input.d.ts +0 -10
  150. package/modules/input.js +0 -83
  151. package/modules/input.js.map +0 -1
  152. package/modules/keyboard.d.ts +0 -58
  153. package/modules/keyboard.js +0 -713
  154. package/modules/keyboard.js.map +0 -1
  155. package/modules/normalizeExternalHTML/index.d.ts +0 -2
  156. package/modules/normalizeExternalHTML/index.js +0 -12
  157. package/modules/normalizeExternalHTML/index.js.map +0 -1
  158. package/modules/normalizeExternalHTML/normalizers/googleDocs.d.ts +0 -1
  159. package/modules/normalizeExternalHTML/normalizers/googleDocs.js +0 -24
  160. package/modules/normalizeExternalHTML/normalizers/googleDocs.js.map +0 -1
  161. package/modules/normalizeExternalHTML/normalizers/msWord.d.ts +0 -1
  162. package/modules/normalizeExternalHTML/normalizers/msWord.js +0 -87
  163. package/modules/normalizeExternalHTML/normalizers/msWord.js.map +0 -1
  164. package/modules/syntax.d.ts +0 -50
  165. package/modules/syntax.js +0 -332
  166. package/modules/syntax.js.map +0 -1
  167. package/modules/table.d.ts +0 -20
  168. package/modules/table.js +0 -125
  169. package/modules/table.js.map +0 -1
  170. package/modules/tableEmbed.d.ts +0 -27
  171. package/modules/tableEmbed.js +0 -209
  172. package/modules/tableEmbed.js.map +0 -1
  173. package/modules/toolbar.d.ts +0 -24
  174. package/modules/toolbar.js +0 -265
  175. package/modules/toolbar.js.map +0 -1
  176. package/modules/uiNode.d.ts +0 -19
  177. package/modules/uiNode.js +0 -95
  178. package/modules/uiNode.js.map +0 -1
  179. package/modules/uploader.d.ts +0 -15
  180. package/modules/uploader.js +0 -69
  181. package/modules/uploader.js.map +0 -1
  182. package/quill.d.ts +0 -5
  183. package/quill.js +0 -82
  184. package/quill.js.map +0 -1
  185. package/themes/base.d.ts +0 -35
  186. package/themes/base.js +0 -257
  187. package/themes/base.js.map +0 -1
  188. package/themes/bubble.d.ts +0 -18
  189. package/themes/bubble.js +0 -114
  190. package/themes/bubble.js.map +0 -1
  191. package/themes/snow.d.ts +0 -9
  192. package/themes/snow.js +0 -122
  193. package/themes/snow.js.map +0 -1
  194. package/types.d.js +0 -2
  195. package/types.d.js.map +0 -1
  196. package/ui/color-picker.d.ts +0 -7
  197. package/ui/color-picker.js +0 -30
  198. package/ui/color-picker.js.map +0 -1
  199. package/ui/icon-picker.d.ts +0 -7
  200. package/ui/icon-picker.js +0 -22
  201. package/ui/icon-picker.js.map +0 -1
  202. package/ui/icons.d.ts +0 -49
  203. package/ui/icons.js +0 -82
  204. package/ui/icons.js.map +0 -1
  205. package/ui/picker.d.ts +0 -16
  206. package/ui/picker.js +0 -171
  207. package/ui/picker.js.map +0 -1
  208. package/ui/tooltip.d.ts +0 -12
  209. package/ui/tooltip.js +0 -56
  210. package/ui/tooltip.js.map +0 -1
  211. /package/{assets → src/assets}/base.styl +0 -0
  212. /package/{assets → src/assets}/bubble/toolbar.styl +0 -0
  213. /package/{assets → src/assets}/bubble/tooltip.styl +0 -0
  214. /package/{assets → src/assets}/bubble.styl +0 -0
  215. /package/{assets → src/assets}/core.styl +0 -0
  216. /package/{assets → src/assets}/favicon.png +0 -0
  217. /package/{assets → src/assets}/icons/align-center.svg +0 -0
  218. /package/{assets → src/assets}/icons/align-justify.svg +0 -0
  219. /package/{assets → src/assets}/icons/align-left.svg +0 -0
  220. /package/{assets → src/assets}/icons/align-right.svg +0 -0
  221. /package/{assets → src/assets}/icons/attachment.svg +0 -0
  222. /package/{assets → src/assets}/icons/audio.svg +0 -0
  223. /package/{assets → src/assets}/icons/authorship.svg +0 -0
  224. /package/{assets → src/assets}/icons/background.svg +0 -0
  225. /package/{assets → src/assets}/icons/blockquote.svg +0 -0
  226. /package/{assets → src/assets}/icons/bold.svg +0 -0
  227. /package/{assets → src/assets}/icons/clean.svg +0 -0
  228. /package/{assets → src/assets}/icons/code.svg +0 -0
  229. /package/{assets → src/assets}/icons/color.svg +0 -0
  230. /package/{assets → src/assets}/icons/comment.svg +0 -0
  231. /package/{assets → src/assets}/icons/direction-ltr.svg +0 -0
  232. /package/{assets → src/assets}/icons/direction-rtl.svg +0 -0
  233. /package/{assets → src/assets}/icons/dropdown.svg +0 -0
  234. /package/{assets → src/assets}/icons/embed.svg +0 -0
  235. /package/{assets → src/assets}/icons/emoji.svg +0 -0
  236. /package/{assets → src/assets}/icons/float-center.svg +0 -0
  237. /package/{assets → src/assets}/icons/float-full.svg +0 -0
  238. /package/{assets → src/assets}/icons/float-left.svg +0 -0
  239. /package/{assets → src/assets}/icons/float-right.svg +0 -0
  240. /package/{assets → src/assets}/icons/font.svg +0 -0
  241. /package/{assets → src/assets}/icons/formula.svg +0 -0
  242. /package/{assets → src/assets}/icons/hashtag.svg +0 -0
  243. /package/{assets → src/assets}/icons/header-2.svg +0 -0
  244. /package/{assets → src/assets}/icons/header-3.svg +0 -0
  245. /package/{assets → src/assets}/icons/header-4.svg +0 -0
  246. /package/{assets → src/assets}/icons/header-5.svg +0 -0
  247. /package/{assets → src/assets}/icons/header-6.svg +0 -0
  248. /package/{assets → src/assets}/icons/header.svg +0 -0
  249. /package/{assets → src/assets}/icons/horizontal-rule.svg +0 -0
  250. /package/{assets → src/assets}/icons/image.svg +0 -0
  251. /package/{assets → src/assets}/icons/indent.svg +0 -0
  252. /package/{assets → src/assets}/icons/italic.svg +0 -0
  253. /package/{assets → src/assets}/icons/link.svg +0 -0
  254. /package/{assets → src/assets}/icons/list-bullet.svg +0 -0
  255. /package/{assets → src/assets}/icons/list-check.svg +0 -0
  256. /package/{assets → src/assets}/icons/list-ordered.svg +0 -0
  257. /package/{assets → src/assets}/icons/map.svg +0 -0
  258. /package/{assets → src/assets}/icons/mention.svg +0 -0
  259. /package/{assets → src/assets}/icons/more.svg +0 -0
  260. /package/{assets → src/assets}/icons/outdent.svg +0 -0
  261. /package/{assets → src/assets}/icons/redo.svg +0 -0
  262. /package/{assets → src/assets}/icons/size-decrease.svg +0 -0
  263. /package/{assets → src/assets}/icons/size-increase.svg +0 -0
  264. /package/{assets → src/assets}/icons/size.svg +0 -0
  265. /package/{assets → src/assets}/icons/spacing.svg +0 -0
  266. /package/{assets → src/assets}/icons/speech.svg +0 -0
  267. /package/{assets → src/assets}/icons/strike.svg +0 -0
  268. /package/{assets → src/assets}/icons/subscript.svg +0 -0
  269. /package/{assets → src/assets}/icons/superscript.svg +0 -0
  270. /package/{assets → src/assets}/icons/table-border-all.svg +0 -0
  271. /package/{assets → src/assets}/icons/table-border-bottom.svg +0 -0
  272. /package/{assets → src/assets}/icons/table-border-left.svg +0 -0
  273. /package/{assets → src/assets}/icons/table-border-none.svg +0 -0
  274. /package/{assets → src/assets}/icons/table-border-outside.svg +0 -0
  275. /package/{assets → src/assets}/icons/table-border-right.svg +0 -0
  276. /package/{assets → src/assets}/icons/table-border-top.svg +0 -0
  277. /package/{assets → src/assets}/icons/table-delete-cells.svg +0 -0
  278. /package/{assets → src/assets}/icons/table-delete-columns.svg +0 -0
  279. /package/{assets → src/assets}/icons/table-delete-rows.svg +0 -0
  280. /package/{assets → src/assets}/icons/table-insert-cells.svg +0 -0
  281. /package/{assets → src/assets}/icons/table-insert-columns.svg +0 -0
  282. /package/{assets → src/assets}/icons/table-insert-rows.svg +0 -0
  283. /package/{assets → src/assets}/icons/table-merge-cells.svg +0 -0
  284. /package/{assets → src/assets}/icons/table-unmerge-cells.svg +0 -0
  285. /package/{assets → src/assets}/icons/table.svg +0 -0
  286. /package/{assets → src/assets}/icons/underline.svg +0 -0
  287. /package/{assets → src/assets}/icons/undo.svg +0 -0
  288. /package/{assets → src/assets}/icons/video.svg +0 -0
  289. /package/{assets → src/assets}/snow/toolbar.styl +0 -0
  290. /package/{assets → src/assets}/snow/tooltip.styl +0 -0
  291. /package/{assets → src/assets}/snow.styl +0 -0
@@ -0,0 +1,12 @@
1
+ const pkg = require('./package.json');
2
+
3
+ module.exports = {
4
+ presets: [
5
+ ['@babel/preset-env', { modules: false }],
6
+ '@babel/preset-typescript',
7
+ ],
8
+ plugins: [
9
+ ['transform-define', { QUILL_VERSION: pkg.version }],
10
+ './scripts/babel-svg-inline-import.cjs',
11
+ ],
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plotdb/quill",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "upstream": "slab/quill@2.0.3",
5
5
  "description": "Your powerful, rich text editor",
6
6
  "author": "Jason Chen <jhchen7@gmail.com>",
@@ -11,6 +11,7 @@
11
11
  "eventemitter3": "^5.0.1",
12
12
  "lodash-es": "^4.17.21",
13
13
  "parchment": "^3.0.0",
14
+ "quill": "2.0.3",
14
15
  "quill-delta": "^5.1.0"
15
16
  },
16
17
  "devDependencies": {
@@ -0,0 +1,44 @@
1
+ const fs = require('fs');
2
+ const { dirname, resolve } = require('path');
3
+ const { optimize } = require('svgo');
4
+
5
+ module.exports = ({ types: t }) => {
6
+ class BabelSVGInlineImport {
7
+ constructor() {
8
+ return {
9
+ visitor: {
10
+ ImportDeclaration: {
11
+ exit(path, state) {
12
+ const givenPath = path.node.source.value;
13
+ if (!givenPath.endsWith('.svg')) {
14
+ return;
15
+ }
16
+ const specifier = path.node.specifiers[0];
17
+ const id = specifier.local.name;
18
+ const reference = state && state.file && state.file.opts.filename;
19
+ const absolutePath = resolve(dirname(reference), givenPath);
20
+ const content = optimize(
21
+ fs.readFileSync(absolutePath).toString(),
22
+ { plugins: [] },
23
+ ).data;
24
+
25
+ const variableValue = t.stringLiteral(content);
26
+ const variable = t.variableDeclarator(
27
+ t.identifier(id),
28
+ variableValue,
29
+ );
30
+
31
+ path.replaceWith({
32
+ type: 'VariableDeclaration',
33
+ kind: 'const',
34
+ declarations: [variable],
35
+ });
36
+ },
37
+ },
38
+ },
39
+ };
40
+ }
41
+ }
42
+
43
+ return new BabelSVGInlineImport();
44
+ };
package/scripts/build ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ DIST=dist
6
+
7
+ TMPDIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
8
+ npx tsc --declaration --emitDeclarationOnly --skipLibCheck --outDir $TMPDIR
9
+
10
+ rm -rf $DIST
11
+ mkdir $DIST
12
+ mv $TMPDIR/src/* $DIST
13
+ rm -rf $TMPDIR
14
+ npx babel src --out-dir $DIST --copy-files --no-copy-ignored --extensions .ts --source-maps
15
+ npx webpack -- --mode $1
16
+ # https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151
17
+ rm -rf $DIST/dist/*.css.js $DIST/dist/*.css.js.*
18
+ cp package.json $DIST
19
+ cp README.md $DIST
20
+ cp LICENSE $DIST
package/src/types.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare module '*.svg' {
2
+ const content: string;
3
+ export default content;
4
+ }
5
+
6
+ declare const QUILL_VERSION: string | undefined;
@@ -0,0 +1,69 @@
1
+ /*eslint-env node*/
2
+
3
+ const { resolve } = require('path');
4
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
+
6
+ const tsRules = {
7
+ test: /\.ts$/,
8
+ include: [resolve(__dirname, 'src')],
9
+ use: ['babel-loader'],
10
+ };
11
+
12
+ const sourceMapRules = {
13
+ test: /\.js$/,
14
+ enforce: 'pre',
15
+ use: ['source-map-loader'],
16
+ };
17
+
18
+ const svgRules = {
19
+ test: /\.svg$/,
20
+ include: [resolve(__dirname, 'src/assets/icons')],
21
+ use: [
22
+ {
23
+ loader: 'html-loader',
24
+ options: {
25
+ minimize: true,
26
+ },
27
+ },
28
+ ],
29
+ };
30
+
31
+ const stylRules = {
32
+ test: /\.styl$/,
33
+ include: [resolve(__dirname, 'src/assets')],
34
+ use: [MiniCssExtractPlugin.loader, 'css-loader', 'stylus-loader'],
35
+ };
36
+
37
+ module.exports = {
38
+ entry: {
39
+ quill: './src/quill.ts',
40
+ 'quill.core': './src/core.ts',
41
+ 'quill.core.css': './src/assets/core.styl',
42
+ 'quill.bubble.css': './src/assets/bubble.styl',
43
+ 'quill.snow.css': './src/assets/snow.styl',
44
+ },
45
+ output: {
46
+ filename: '[name].js',
47
+ library: {
48
+ name: 'Quill',
49
+ type: 'umd',
50
+ export: 'default',
51
+ },
52
+ path: resolve(__dirname, 'dist/dist'),
53
+ clean: true,
54
+ },
55
+ resolve: {
56
+ extensions: ['.js', '.styl', '.ts'],
57
+ extensionAlias: {
58
+ '.js': ['.ts', '.js'],
59
+ },
60
+ },
61
+ module: {
62
+ rules: [tsRules, stylRules, svgRules, sourceMapRules],
63
+ },
64
+ plugins: [
65
+ new MiniCssExtractPlugin({
66
+ filename: '[name]',
67
+ }),
68
+ ],
69
+ };
@@ -0,0 +1,42 @@
1
+ /*eslint-env node*/
2
+
3
+ const { BannerPlugin, DefinePlugin } = require('webpack');
4
+ const common = require('./webpack.common.cjs');
5
+ const { merge } = require('webpack-merge');
6
+ require('webpack-dev-server');
7
+ const { readFileSync } = require('fs');
8
+ const { join, resolve } = require('path');
9
+
10
+ const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
11
+
12
+ const bannerPack = new BannerPlugin({
13
+ banner: [
14
+ `Quill Editor v${pkg.version}`,
15
+ pkg.homepage,
16
+ `Copyright (c) 2017-${new Date().getFullYear()}, Slab`,
17
+ 'Copyright (c) 2014, Jason Chen',
18
+ 'Copyright (c) 2013, salesforce.com',
19
+ ].join('\n'),
20
+ entryOnly: true,
21
+ });
22
+ const constantPack = new DefinePlugin({
23
+ QUILL_VERSION: JSON.stringify(pkg.version),
24
+ });
25
+
26
+ module.exports = (env) =>
27
+ merge(common, {
28
+ mode: env.production ? 'production' : 'development',
29
+ devtool: 'source-map',
30
+ plugins: [bannerPack, constantPack],
31
+ devServer: {
32
+ static: {
33
+ directory: resolve(__dirname, './dist'),
34
+ },
35
+ hot: false,
36
+ allowedHosts: 'all',
37
+ devMiddleware: {
38
+ stats: 'minimal',
39
+ },
40
+ },
41
+ stats: 'minimal',
42
+ });
package/blots/block.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { AttributorStore, BlockBlot, EmbedBlot } from 'parchment';
2
- import type { Blot, Parent } from 'parchment';
3
- import Delta from 'quill-delta';
4
- declare class Block extends BlockBlot {
5
- cache: {
6
- delta?: Delta | null;
7
- length?: number;
8
- };
9
- delta(): Delta;
10
- deleteAt(index: number, length: number): void;
11
- formatAt(index: number, length: number, name: string, value: unknown): void;
12
- insertAt(index: number, value: string, def?: unknown): void;
13
- insertBefore(blot: Blot, ref?: Blot | null): void;
14
- length(): number;
15
- moveChildren(target: Parent, ref?: Blot | null): void;
16
- optimize(context: {
17
- [key: string]: any;
18
- }): void;
19
- path(index: number): [Blot, number][];
20
- removeChild(child: Blot): void;
21
- split(index: number, force?: boolean | undefined): Blot | null;
22
- }
23
- declare class BlockEmbed extends EmbedBlot {
24
- attributes: AttributorStore;
25
- domNode: HTMLElement;
26
- attach(): void;
27
- delta(): Delta;
28
- format(name: string, value: unknown): void;
29
- formatAt(index: number, length: number, name: string, value: unknown): void;
30
- insertAt(index: number, value: string, def?: unknown): void;
31
- }
32
- declare function blockDelta(blot: BlockBlot, filter?: boolean): Delta;
33
- declare function bubbleFormats(blot: Blot | null, formats?: Record<string, unknown>, filter?: boolean): Record<string, unknown>;
34
- export { blockDelta, bubbleFormats, BlockEmbed, Block as default };
package/blots/block.js DELETED
@@ -1,182 +0,0 @@
1
- import { AttributorStore, BlockBlot, EmbedBlot, LeafBlot, Scope } from 'parchment';
2
- import Delta from 'quill-delta';
3
- import Break from './break.js';
4
- import Inline from './inline.js';
5
- import TextBlot from './text.js';
6
- const NEWLINE_LENGTH = 1;
7
- class Block extends BlockBlot {
8
- cache = {};
9
- delta() {
10
- if (this.cache.delta == null) {
11
- this.cache.delta = blockDelta(this);
12
- }
13
- return this.cache.delta;
14
- }
15
- deleteAt(index, length) {
16
- super.deleteAt(index, length);
17
- this.cache = {};
18
- }
19
- formatAt(index, length, name, value) {
20
- if (length <= 0) return;
21
- if (this.scroll.query(name, Scope.BLOCK)) {
22
- if (index + length === this.length()) {
23
- this.format(name, value);
24
- }
25
- } else {
26
- super.formatAt(index, Math.min(length, this.length() - index - 1), name, value);
27
- }
28
- this.cache = {};
29
- }
30
- insertAt(index, value, def) {
31
- if (def != null) {
32
- super.insertAt(index, value, def);
33
- this.cache = {};
34
- return;
35
- }
36
- if (value.length === 0) return;
37
- const lines = value.split('\n');
38
- const text = lines.shift();
39
- if (text.length > 0) {
40
- if (index < this.length() - 1 || this.children.tail == null) {
41
- super.insertAt(Math.min(index, this.length() - 1), text);
42
- } else {
43
- this.children.tail.insertAt(this.children.tail.length(), text);
44
- }
45
- this.cache = {};
46
- }
47
- // TODO: Fix this next time the file is edited.
48
- // eslint-disable-next-line @typescript-eslint/no-this-alias
49
- let block = this;
50
- lines.reduce((lineIndex, line) => {
51
- // @ts-expect-error Fix me later
52
- block = block.split(lineIndex, true);
53
- block.insertAt(0, line);
54
- return line.length;
55
- }, index + text.length);
56
- }
57
- insertBefore(blot, ref) {
58
- const {
59
- head
60
- } = this.children;
61
- super.insertBefore(blot, ref);
62
- if (head instanceof Break) {
63
- head.remove();
64
- }
65
- this.cache = {};
66
- }
67
- length() {
68
- if (this.cache.length == null) {
69
- this.cache.length = super.length() + NEWLINE_LENGTH;
70
- }
71
- return this.cache.length;
72
- }
73
- moveChildren(target, ref) {
74
- super.moveChildren(target, ref);
75
- this.cache = {};
76
- }
77
- optimize(context) {
78
- super.optimize(context);
79
- this.cache = {};
80
- }
81
- path(index) {
82
- return super.path(index, true);
83
- }
84
- removeChild(child) {
85
- super.removeChild(child);
86
- this.cache = {};
87
- }
88
- split(index) {
89
- let force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
90
- if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
91
- const clone = this.clone();
92
- if (index === 0) {
93
- this.parent.insertBefore(clone, this);
94
- return this;
95
- }
96
- this.parent.insertBefore(clone, this.next);
97
- return clone;
98
- }
99
- const next = super.split(index, force);
100
- this.cache = {};
101
- return next;
102
- }
103
- }
104
- Block.blotName = 'block';
105
- Block.tagName = 'P';
106
- Block.defaultChild = Break;
107
- Block.allowedChildren = [Break, Inline, EmbedBlot, TextBlot];
108
- class BlockEmbed extends EmbedBlot {
109
- attach() {
110
- super.attach();
111
- this.attributes = new AttributorStore(this.domNode);
112
- }
113
- delta() {
114
- return new Delta().insert(this.value(), {
115
- ...this.formats(),
116
- ...this.attributes.values()
117
- });
118
- }
119
- format(name, value) {
120
- const attribute = this.scroll.query(name, Scope.BLOCK_ATTRIBUTE);
121
- if (attribute != null) {
122
- // @ts-expect-error TODO: Scroll#query() should return Attributor when scope is attribute
123
- this.attributes.attribute(attribute, value);
124
- }
125
- }
126
- formatAt(index, length, name, value) {
127
- this.format(name, value);
128
- }
129
- insertAt(index, value, def) {
130
- if (def != null) {
131
- super.insertAt(index, value, def);
132
- return;
133
- }
134
- const lines = value.split('\n');
135
- const text = lines.pop();
136
- const blocks = lines.map(line => {
137
- const block = this.scroll.create(Block.blotName);
138
- block.insertAt(0, line);
139
- return block;
140
- });
141
- const ref = this.split(index);
142
- blocks.forEach(block => {
143
- this.parent.insertBefore(block, ref);
144
- });
145
- if (text) {
146
- this.parent.insertBefore(this.scroll.create('text', text), ref);
147
- }
148
- }
149
- }
150
- BlockEmbed.scope = Scope.BLOCK_BLOT;
151
- // It is important for cursor behavior BlockEmbeds use tags that are block level elements
152
-
153
- function blockDelta(blot) {
154
- let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
155
- return blot.descendants(LeafBlot).reduce((delta, leaf) => {
156
- if (leaf.length() === 0) {
157
- return delta;
158
- }
159
- return delta.insert(leaf.value(), bubbleFormats(leaf, {}, filter));
160
- }, new Delta()).insert('\n', bubbleFormats(blot));
161
- }
162
- function bubbleFormats(blot) {
163
- let formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
164
- let filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
165
- if (blot == null) return formats;
166
- if ('formats' in blot && typeof blot.formats === 'function') {
167
- formats = {
168
- ...formats,
169
- ...blot.formats()
170
- };
171
- if (filter) {
172
- // exclude syntax highlighting from deltas and getFormat()
173
- delete formats['code-token'];
174
- }
175
- }
176
- if (blot.parent == null || blot.parent.statics.blotName === 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
177
- return formats;
178
- }
179
- return bubbleFormats(blot.parent, formats, filter);
180
- }
181
- export { blockDelta, bubbleFormats, BlockEmbed, Block as default };
182
- //# sourceMappingURL=block.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"block.js","names":["AttributorStore","BlockBlot","EmbedBlot","LeafBlot","Scope","Delta","Break","Inline","TextBlot","NEWLINE_LENGTH","Block","cache","delta","blockDelta","deleteAt","index","length","formatAt","name","value","scroll","query","BLOCK","format","Math","min","insertAt","def","lines","split","text","shift","children","tail","block","reduce","lineIndex","line","insertBefore","blot","ref","head","remove","moveChildren","target","optimize","context","path","removeChild","child","force","arguments","undefined","clone","parent","next","blotName","tagName","defaultChild","allowedChildren","BlockEmbed","attach","attributes","domNode","insert","formats","values","attribute","BLOCK_ATTRIBUTE","pop","blocks","map","create","forEach","scope","BLOCK_BLOT","filter","descendants","leaf","bubbleFormats","statics","default"],"sources":["../../src/blots/block.ts"],"sourcesContent":["import {\n AttributorStore,\n BlockBlot,\n EmbedBlot,\n LeafBlot,\n Scope,\n} from 'parchment';\nimport type { Blot, Parent } from 'parchment';\nimport Delta from 'quill-delta';\nimport Break from './break.js';\nimport Inline from './inline.js';\nimport TextBlot from './text.js';\n\nconst NEWLINE_LENGTH = 1;\n\nclass Block extends BlockBlot {\n cache: { delta?: Delta | null; length?: number } = {};\n\n delta(): Delta {\n if (this.cache.delta == null) {\n this.cache.delta = blockDelta(this);\n }\n return this.cache.delta;\n }\n\n deleteAt(index: number, length: number) {\n super.deleteAt(index, length);\n this.cache = {};\n }\n\n formatAt(index: number, length: number, name: string, value: unknown) {\n if (length <= 0) return;\n if (this.scroll.query(name, Scope.BLOCK)) {\n if (index + length === this.length()) {\n this.format(name, value);\n }\n } else {\n super.formatAt(\n index,\n Math.min(length, this.length() - index - 1),\n name,\n value,\n );\n }\n this.cache = {};\n }\n\n insertAt(index: number, value: string, def?: unknown) {\n if (def != null) {\n super.insertAt(index, value, def);\n this.cache = {};\n return;\n }\n if (value.length === 0) return;\n const lines = value.split('\\n');\n const text = lines.shift() as string;\n if (text.length > 0) {\n if (index < this.length() - 1 || this.children.tail == null) {\n super.insertAt(Math.min(index, this.length() - 1), text);\n } else {\n this.children.tail.insertAt(this.children.tail.length(), text);\n }\n this.cache = {};\n }\n // TODO: Fix this next time the file is edited.\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let block: Blot | this = this;\n lines.reduce((lineIndex, line) => {\n // @ts-expect-error Fix me later\n block = block.split(lineIndex, true);\n block.insertAt(0, line);\n return line.length;\n }, index + text.length);\n }\n\n insertBefore(blot: Blot, ref?: Blot | null) {\n const { head } = this.children;\n super.insertBefore(blot, ref);\n if (head instanceof Break) {\n head.remove();\n }\n this.cache = {};\n }\n\n length() {\n if (this.cache.length == null) {\n this.cache.length = super.length() + NEWLINE_LENGTH;\n }\n return this.cache.length;\n }\n\n moveChildren(target: Parent, ref?: Blot | null) {\n super.moveChildren(target, ref);\n this.cache = {};\n }\n\n optimize(context: { [key: string]: any }) {\n super.optimize(context);\n this.cache = {};\n }\n\n path(index: number) {\n return super.path(index, true);\n }\n\n removeChild(child: Blot) {\n super.removeChild(child);\n this.cache = {};\n }\n\n split(index: number, force: boolean | undefined = false): Blot | null {\n if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {\n const clone = this.clone();\n if (index === 0) {\n this.parent.insertBefore(clone, this);\n return this;\n }\n this.parent.insertBefore(clone, this.next);\n return clone;\n }\n const next = super.split(index, force);\n this.cache = {};\n return next;\n }\n}\nBlock.blotName = 'block';\nBlock.tagName = 'P';\nBlock.defaultChild = Break;\nBlock.allowedChildren = [Break, Inline, EmbedBlot, TextBlot];\n\nclass BlockEmbed extends EmbedBlot {\n attributes: AttributorStore;\n domNode: HTMLElement;\n\n attach() {\n super.attach();\n this.attributes = new AttributorStore(this.domNode);\n }\n\n delta() {\n return new Delta().insert(this.value(), {\n ...this.formats(),\n ...this.attributes.values(),\n });\n }\n\n format(name: string, value: unknown) {\n const attribute = this.scroll.query(name, Scope.BLOCK_ATTRIBUTE);\n if (attribute != null) {\n // @ts-expect-error TODO: Scroll#query() should return Attributor when scope is attribute\n this.attributes.attribute(attribute, value);\n }\n }\n\n formatAt(index: number, length: number, name: string, value: unknown) {\n this.format(name, value);\n }\n\n insertAt(index: number, value: string, def?: unknown) {\n if (def != null) {\n super.insertAt(index, value, def);\n return;\n }\n const lines = value.split('\\n');\n const text = lines.pop();\n const blocks = lines.map((line) => {\n const block = this.scroll.create(Block.blotName);\n block.insertAt(0, line);\n return block;\n });\n const ref = this.split(index);\n blocks.forEach((block) => {\n this.parent.insertBefore(block, ref);\n });\n if (text) {\n this.parent.insertBefore(this.scroll.create('text', text), ref);\n }\n }\n}\nBlockEmbed.scope = Scope.BLOCK_BLOT;\n// It is important for cursor behavior BlockEmbeds use tags that are block level elements\n\nfunction blockDelta(blot: BlockBlot, filter = true) {\n return blot\n .descendants(LeafBlot)\n .reduce((delta, leaf) => {\n if (leaf.length() === 0) {\n return delta;\n }\n return delta.insert(leaf.value(), bubbleFormats(leaf, {}, filter));\n }, new Delta())\n .insert('\\n', bubbleFormats(blot));\n}\n\nfunction bubbleFormats(\n blot: Blot | null,\n formats: Record<string, unknown> = {},\n filter = true,\n): Record<string, unknown> {\n if (blot == null) return formats;\n if ('formats' in blot && typeof blot.formats === 'function') {\n formats = {\n ...formats,\n ...blot.formats(),\n };\n if (filter) {\n // exclude syntax highlighting from deltas and getFormat()\n delete formats['code-token'];\n }\n }\n if (\n blot.parent == null ||\n blot.parent.statics.blotName === 'scroll' ||\n blot.parent.statics.scope !== blot.statics.scope\n ) {\n return formats;\n }\n return bubbleFormats(blot.parent, formats, filter);\n}\n\nexport { blockDelta, bubbleFormats, BlockEmbed, Block as default };\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,KAAK,QACA,WAAW;AAElB,OAAOC,KAA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CAACxB,QAAQ,KAAK,QAAQ,IACzCjB,IAAI,CAACe,MAAM,CAAC0B,OAAO,CAACN,KAAK,KAAKnC,IAAI,CAACyC,OAAO,CAACN,KAAK,EAChD;IACA,OAAOT,OAAO;EAChB;EACA,OAAOc,aAAa,CAACxC,IAAI,CAACe,MAAM,EAAEW,OAAO,EAAEW,MAAM,CAAC;AACpD;AAEA,SAAS/D,UAAU,EAAEkE,aAAa,EAAEnB,UAAU,EAAElD,KAAK,IAAIuE,OAAO","ignoreList":[]}
package/blots/break.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { EmbedBlot } from 'parchment';
2
- declare class Break extends EmbedBlot {
3
- static value(): undefined;
4
- optimize(): void;
5
- length(): number;
6
- value(): string;
7
- }
8
- export default Break;
package/blots/break.js DELETED
@@ -1,21 +0,0 @@
1
- import { EmbedBlot } from 'parchment';
2
- class Break extends EmbedBlot {
3
- static value() {
4
- return undefined;
5
- }
6
- optimize() {
7
- if (this.prev || this.next) {
8
- this.remove();
9
- }
10
- }
11
- length() {
12
- return 0;
13
- }
14
- value() {
15
- return '';
16
- }
17
- }
18
- Break.blotName = 'break';
19
- Break.tagName = 'BR';
20
- export default Break;
21
- //# sourceMappingURL=break.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"break.js","names":["EmbedBlot","Break","value","undefined","optimize","prev","next","remove","length","blotName","tagName"],"sources":["../../src/blots/break.ts"],"sourcesContent":["import { EmbedBlot } from 'parchment';\n\nclass Break extends EmbedBlot {\n static value() {\n return undefined;\n }\n\n optimize() {\n if (this.prev || this.next) {\n this.remove();\n }\n }\n\n length() {\n return 0;\n }\n\n value() {\n return '';\n }\n}\nBreak.blotName = 'break';\nBreak.tagName = 'BR';\n\nexport default Break;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,WAAW;AAErC,MAAMC,KAAK,SAASD,SAAS,CAAC;EAC5B,OAAOE,KAAKA,CAAA,EAAG;IACb,OAAOC,SAAS;EAClB;EAEAC,QAAQA,CAAA,EAAG;IACT,IAAI,IAAI,CAACC,IAAI,IAAI,IAAI,CAACC,IAAI,EAAE;MAC1B,IAAI,CAACC,MAAM,CAAC,CAAC;IACf;EACF;EAEAC,MAAMA,CAAA,EAAG;IACP,OAAO,CAAC;EACV;EAEAN,KAAKA,CAAA,EAAG;IACN,OAAO,EAAE;EACX;AACF;AACAD,KAAK,CAACQ,QAAQ,GAAG,OAAO;AACxBR,KAAK,CAACS,OAAO,GAAG,IAAI;AAEpB,eAAeT,KAAK","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import { ContainerBlot } from 'parchment';
2
- declare class Container extends ContainerBlot {
3
- }
4
- export default Container;
@@ -1,4 +0,0 @@
1
- import { ContainerBlot } from 'parchment';
2
- class Container extends ContainerBlot {}
3
- export default Container;
4
- //# sourceMappingURL=container.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"container.js","names":["ContainerBlot","Container"],"sources":["../../src/blots/container.ts"],"sourcesContent":["import { ContainerBlot } from 'parchment';\n\nclass Container extends ContainerBlot {}\n\nexport default Container;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,WAAW;AAEzC,MAAMC,SAAS,SAASD,aAAa,CAAC;AAEtC,eAAeC,SAAS","ignoreList":[]}
package/blots/cursor.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { EmbedBlot } from 'parchment';
2
- import type { ScrollBlot } from 'parchment';
3
- import type Selection from '../core/selection.js';
4
- import type { EmbedContextRange } from './embed.js';
5
- declare class Cursor extends EmbedBlot {
6
- static blotName: string;
7
- static className: string;
8
- static tagName: string;
9
- static CONTENTS: string;
10
- static value(): undefined;
11
- selection: Selection;
12
- textNode: Text;
13
- savedLength: number;
14
- constructor(scroll: ScrollBlot, domNode: HTMLElement, selection: Selection);
15
- detach(): void;
16
- format(name: string, value: unknown): void;
17
- index(node: Node, offset: number): number;
18
- length(): number;
19
- position(): [Text, number];
20
- remove(): void;
21
- restore(): EmbedContextRange | null;
22
- update(mutations: MutationRecord[], context: Record<string, unknown>): void;
23
- optimize(context?: unknown): void;
24
- value(): string;
25
- }
26
- export default Cursor;