@editora/plugins 1.0.8 → 1.0.10
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.
- package/README.md +27 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1111 -0
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1384 -0
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1530 -0
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1421 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1147 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +953 -0
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1378 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +58 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +124 -93
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +774 -0
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +67 -51
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1447 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +37 -32
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +788 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1444 -0
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +817 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1794 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +797 -0
- package/index.d.ts +798 -0
- package/package.json +114 -9
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editora/plugins",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "Enterprise plugin suite for Editora rich text editor in React and web apps, including tables, media, workflow, and compliance tooling.",
|
|
5
5
|
"author": "Ajay Kumar <ajaykr089@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -9,11 +9,17 @@
|
|
|
9
9
|
"url": "https://github.com/ajaykr089/Editora.git",
|
|
10
10
|
"directory": "packages/plugins"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://editora-
|
|
12
|
+
"homepage": "https://editora-ecosystem.netlify.app/",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/ajaykr089/Editora/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
+
"react ui library",
|
|
18
|
+
"react component library",
|
|
19
|
+
"saas ui components",
|
|
20
|
+
"enterprise react components",
|
|
21
|
+
"modern design system",
|
|
22
|
+
"rich text editor react",
|
|
17
23
|
"editor-plugins",
|
|
18
24
|
"rich-text",
|
|
19
25
|
"formatting",
|
|
@@ -54,6 +60,12 @@
|
|
|
54
60
|
"require": "./dist/lite.cjs.js",
|
|
55
61
|
"default": "./dist/lite.esm.js"
|
|
56
62
|
},
|
|
63
|
+
"./enterprise": {
|
|
64
|
+
"types": "./index.d.ts",
|
|
65
|
+
"import": "./dist/enterprise.esm.js",
|
|
66
|
+
"require": "./dist/enterprise.cjs.js",
|
|
67
|
+
"default": "./dist/enterprise.esm.js"
|
|
68
|
+
},
|
|
57
69
|
"./shared-config": {
|
|
58
70
|
"types": "./index.d.ts",
|
|
59
71
|
"import": "./dist/shared-config.esm.js",
|
|
@@ -72,6 +84,24 @@
|
|
|
72
84
|
"require": "./dist/anchor.cjs.js",
|
|
73
85
|
"default": "./dist/anchor.esm.js"
|
|
74
86
|
},
|
|
87
|
+
"./approval-workflow": {
|
|
88
|
+
"types": "./index.d.ts",
|
|
89
|
+
"import": "./dist/approval-workflow.esm.js",
|
|
90
|
+
"require": "./dist/approval-workflow.cjs.js",
|
|
91
|
+
"default": "./dist/approval-workflow.esm.js"
|
|
92
|
+
},
|
|
93
|
+
"./pii-redaction": {
|
|
94
|
+
"types": "./index.d.ts",
|
|
95
|
+
"import": "./dist/pii-redaction.esm.js",
|
|
96
|
+
"require": "./dist/pii-redaction.cjs.js",
|
|
97
|
+
"default": "./dist/pii-redaction.esm.js"
|
|
98
|
+
},
|
|
99
|
+
"./smart-paste": {
|
|
100
|
+
"types": "./index.d.ts",
|
|
101
|
+
"import": "./dist/smart-paste.esm.js",
|
|
102
|
+
"require": "./dist/smart-paste.cjs.js",
|
|
103
|
+
"default": "./dist/smart-paste.esm.js"
|
|
104
|
+
},
|
|
75
105
|
"./background-color": {
|
|
76
106
|
"types": "./index.d.ts",
|
|
77
107
|
"import": "./dist/background-color.esm.js",
|
|
@@ -84,6 +114,12 @@
|
|
|
84
114
|
"require": "./dist/blockquote.cjs.js",
|
|
85
115
|
"default": "./dist/blockquote.esm.js"
|
|
86
116
|
},
|
|
117
|
+
"./blocks-library": {
|
|
118
|
+
"types": "./index.d.ts",
|
|
119
|
+
"import": "./dist/blocks-library.esm.js",
|
|
120
|
+
"require": "./dist/blocks-library.cjs.js",
|
|
121
|
+
"default": "./dist/blocks-library.esm.js"
|
|
122
|
+
},
|
|
87
123
|
"./bold": {
|
|
88
124
|
"types": "./index.d.ts",
|
|
89
125
|
"import": "./dist/bold.esm.js",
|
|
@@ -96,6 +132,42 @@
|
|
|
96
132
|
"require": "./dist/capitalization.cjs.js",
|
|
97
133
|
"default": "./dist/capitalization.esm.js"
|
|
98
134
|
},
|
|
135
|
+
"./conditional-content": {
|
|
136
|
+
"types": "./index.d.ts",
|
|
137
|
+
"import": "./dist/conditional-content.esm.js",
|
|
138
|
+
"require": "./dist/conditional-content.cjs.js",
|
|
139
|
+
"default": "./dist/conditional-content.esm.js"
|
|
140
|
+
},
|
|
141
|
+
"./content-rules": {
|
|
142
|
+
"types": "./index.d.ts",
|
|
143
|
+
"import": "./dist/content-rules.esm.js",
|
|
144
|
+
"require": "./dist/content-rules.cjs.js",
|
|
145
|
+
"default": "./dist/content-rules.esm.js"
|
|
146
|
+
},
|
|
147
|
+
"./citations": {
|
|
148
|
+
"types": "./index.d.ts",
|
|
149
|
+
"import": "./dist/citations.esm.js",
|
|
150
|
+
"require": "./dist/citations.cjs.js",
|
|
151
|
+
"default": "./dist/citations.esm.js"
|
|
152
|
+
},
|
|
153
|
+
"./data-binding": {
|
|
154
|
+
"types": "./index.d.ts",
|
|
155
|
+
"import": "./dist/data-binding.esm.js",
|
|
156
|
+
"require": "./dist/data-binding.cjs.js",
|
|
157
|
+
"default": "./dist/data-binding.esm.js"
|
|
158
|
+
},
|
|
159
|
+
"./doc-schema": {
|
|
160
|
+
"types": "./index.d.ts",
|
|
161
|
+
"import": "./dist/doc-schema.esm.js",
|
|
162
|
+
"require": "./dist/doc-schema.cjs.js",
|
|
163
|
+
"default": "./dist/doc-schema.esm.js"
|
|
164
|
+
},
|
|
165
|
+
"./translation-workflow": {
|
|
166
|
+
"types": "./index.d.ts",
|
|
167
|
+
"import": "./dist/translation-workflow.esm.js",
|
|
168
|
+
"require": "./dist/translation-workflow.cjs.js",
|
|
169
|
+
"default": "./dist/translation-workflow.esm.js"
|
|
170
|
+
},
|
|
99
171
|
"./checklist": {
|
|
100
172
|
"types": "./index.d.ts",
|
|
101
173
|
"import": "./dist/checklist.esm.js",
|
|
@@ -228,6 +300,12 @@
|
|
|
228
300
|
"require": "./dist/media-manager.cjs.js",
|
|
229
301
|
"default": "./dist/media-manager.esm.js"
|
|
230
302
|
},
|
|
303
|
+
"./mentions": {
|
|
304
|
+
"types": "./index.d.ts",
|
|
305
|
+
"import": "./dist/mentions.esm.js",
|
|
306
|
+
"require": "./dist/mentions.cjs.js",
|
|
307
|
+
"default": "./dist/mentions.esm.js"
|
|
308
|
+
},
|
|
231
309
|
"./merge-tag": {
|
|
232
310
|
"types": "./index.d.ts",
|
|
233
311
|
"import": "./dist/merge-tag.esm.js",
|
|
@@ -264,6 +342,12 @@
|
|
|
264
342
|
"require": "./dist/spell-check.cjs.js",
|
|
265
343
|
"default": "./dist/spell-check.esm.js"
|
|
266
344
|
},
|
|
345
|
+
"./slash-commands": {
|
|
346
|
+
"types": "./index.d.ts",
|
|
347
|
+
"import": "./dist/slash-commands.esm.js",
|
|
348
|
+
"require": "./dist/slash-commands.cjs.js",
|
|
349
|
+
"default": "./dist/slash-commands.esm.js"
|
|
350
|
+
},
|
|
267
351
|
"./strikethrough": {
|
|
268
352
|
"types": "./index.d.ts",
|
|
269
353
|
"import": "./dist/strikethrough.esm.js",
|
|
@@ -276,6 +360,18 @@
|
|
|
276
360
|
"require": "./dist/table.cjs.js",
|
|
277
361
|
"default": "./dist/table.esm.js"
|
|
278
362
|
},
|
|
363
|
+
"./track-changes": {
|
|
364
|
+
"types": "./index.d.ts",
|
|
365
|
+
"import": "./dist/track-changes.esm.js",
|
|
366
|
+
"require": "./dist/track-changes.cjs.js",
|
|
367
|
+
"default": "./dist/track-changes.esm.js"
|
|
368
|
+
},
|
|
369
|
+
"./version-diff": {
|
|
370
|
+
"types": "./index.d.ts",
|
|
371
|
+
"import": "./dist/version-diff.esm.js",
|
|
372
|
+
"require": "./dist/version-diff.cjs.js",
|
|
373
|
+
"default": "./dist/version-diff.esm.js"
|
|
374
|
+
},
|
|
279
375
|
"./template": {
|
|
280
376
|
"types": "./index.d.ts",
|
|
281
377
|
"import": "./dist/template.esm.js",
|
|
@@ -311,26 +407,35 @@
|
|
|
311
407
|
],
|
|
312
408
|
"scripts": {
|
|
313
409
|
"build": "vite build",
|
|
314
|
-
"typecheck:build": "tsc -p tsconfig.build.json --noEmit",
|
|
410
|
+
"typecheck:build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.build.json --noEmit",
|
|
315
411
|
"dev": "vite build --watch",
|
|
316
412
|
"clean": "rm -rf dist",
|
|
317
|
-
"prepublishOnly": "npm run typecheck:build && npm run build"
|
|
413
|
+
"prepublishOnly": "npm run typecheck:build && npm run build",
|
|
414
|
+
"test:content-rules": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./content-rules/src/ContentRulesPlugin.native.test.js",
|
|
415
|
+
"test:citations": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./citations/src/CitationsPlugin.native.test.js",
|
|
416
|
+
"test:approval-workflow": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./approval-workflow/src/ApprovalWorkflowPlugin.native.test.js",
|
|
417
|
+
"test:pii-redaction": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./pii-redaction/src/PIIRedactionPlugin.native.test.js",
|
|
418
|
+
"test:smart-paste": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./smart-paste/src/SmartPastePlugin.native.test.js",
|
|
419
|
+
"test:blocks-library": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./blocks-library/src/BlocksLibraryPlugin.native.test.js",
|
|
420
|
+
"test:doc-schema": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./doc-schema/src/DocSchemaPlugin.native.test.js",
|
|
421
|
+
"test:translation-workflow": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./translation-workflow/src/TranslationWorkflowPlugin.native.test.js",
|
|
422
|
+
"verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run build"
|
|
318
423
|
},
|
|
319
424
|
"peerDependencies": {
|
|
320
|
-
"@editora/core": "^1.0.
|
|
425
|
+
"@editora/core": "^1.0.9"
|
|
321
426
|
},
|
|
322
427
|
"dependencies": {
|
|
323
428
|
"katex": "^0.16.27",
|
|
324
429
|
"mathjax": "^3.2.2"
|
|
325
430
|
},
|
|
326
431
|
"devDependencies": {
|
|
327
|
-
"@editora/core": "^1.0.
|
|
432
|
+
"@editora/core": "^1.0.9",
|
|
328
433
|
"@types/katex": "^0.16.8",
|
|
329
434
|
"typescript": "^5.0.0",
|
|
330
|
-
"vite": "^
|
|
435
|
+
"vite": "^4.5.14"
|
|
331
436
|
},
|
|
332
437
|
"publishConfig": {
|
|
333
438
|
"access": "public"
|
|
334
439
|
},
|
|
335
|
-
"gitHead": "
|
|
440
|
+
"gitHead": "7883627e823aa99dd5ecb66a5201116df972f88b"
|
|
336
441
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var t=function o(){var r=!1;try{r=this instanceof o}catch{}return r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),t}exports.commonjsGlobal=u;exports.getAugmentedNamespace=l;exports.getDefaultExportFromCjs=f;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function a(e) {
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
-
}
|
|
5
|
-
function f(e) {
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
7
|
-
var n = e.default;
|
|
8
|
-
if (typeof n == "function") {
|
|
9
|
-
var t = function r() {
|
|
10
|
-
var o = !1;
|
|
11
|
-
try {
|
|
12
|
-
o = this instanceof r;
|
|
13
|
-
} catch {
|
|
14
|
-
}
|
|
15
|
-
return o ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
t.prototype = n.prototype;
|
|
18
|
-
} else t = {};
|
|
19
|
-
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
20
|
-
var o = Object.getOwnPropertyDescriptor(e, r);
|
|
21
|
-
Object.defineProperty(t, r, o.get ? o : {
|
|
22
|
-
enumerable: !0,
|
|
23
|
-
get: function() {
|
|
24
|
-
return e[r];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}), t;
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
f as a,
|
|
31
|
-
u as c,
|
|
32
|
-
a as g
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const b="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function p(e){return!!e.cloneContents().querySelector(b)}function v(e,t){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement??null)?.closest('[contenteditable="true"]')||t()?.querySelector('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function C(e,t){const n=v(e,t);n&&n.dispatchEvent(new Event("input",{bubbles:!0}))}function A(e,t){let r=e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentElement:e.startContainer;for(;r&&r!==document.body;){if(r.classList.contains(t)){const c=document.createRange();if(c.selectNodeContents(r),c.compareBoundaryPoints(Range.START_TO_START,e)<=0&&c.compareBoundaryPoints(Range.END_TO_END,e)>=0)return r}r=r.parentElement}return null}function S(e){try{if(e.savedRange){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(e.savedRange.cloneRange()))}const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0);if(n.collapsed)return!1;const r=A(n,e.className);if(r)return e.styleProperty==="backgroundColor"?r.style.backgroundColor=e.color:r.style.color=e.color,C(r,e.getActiveEditorRoot),!0;v(n.commonAncestorContainer,e.getActiveEditorRoot)?.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}let l=!1;if(e.commands.forEach(o=>{l||(l=document.execCommand(o,!1,e.color))}),!l&&!p(n)){const o=document.createElement("span");e.styleProperty==="backgroundColor"?o.style.backgroundColor=e.color:o.style.color=e.color,o.className=e.className;const a=n.extractContents();o.appendChild(a),n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n),l=!0}return l?(C(n.commonAncestorContainer,e.getActiveEditorRoot),!0):(e.warnMessage&&console.warn(e.warnMessage),!1)}catch(t){return e.warnMessage?console.error(e.warnMessage,t):console.error("[ColorApply] Failed to apply color",t),!1}}function T({popover:e,anchor:t,onClose:n,gap:r=6,margin:c=8,zIndex:l=1e4}){e.style.position="fixed",e.style.zIndex=`${l}`,e.style.visibility="hidden";const o=()=>{if(!e.isConnected||!t.isConnected){n();return}const s=t.getBoundingClientRect();if(s.width===0&&s.height===0){n();return}const i=e.getBoundingClientRect(),y=i.width||e.offsetWidth||220,f=i.height||e.offsetHeight||260,w=window.innerWidth,E=window.innerHeight;let u=s.left,d=s.bottom+r;if(u+y>w-c&&(u=w-y-c),u=Math.max(c,u),d+f>E-c){const g=s.top-f-r;g>=c?d=g:d=Math.max(c,E-f-c)}d<c&&(d=c),e.style.left=`${Math.round(u)}px`,e.style.top=`${Math.round(d)}px`,e.style.visibility="visible"},a=()=>{o()},m=s=>{const i=s.target;i&&(e.contains(i)||t.contains(i)||n())},h=s=>{s.key==="Escape"&&n()};window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),document.addEventListener("keydown",h);const R=window.requestAnimationFrame(()=>{document.addEventListener("mousedown",m,!0)});return o(),{reposition:o,destroy:()=>{window.cancelAnimationFrame(R),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0),document.removeEventListener("keydown",h),document.removeEventListener("mousedown",m,!0)}}}exports.applyColorToSelection=S;exports.attachAnchoredPopover=T;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
const b = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
|
|
2
|
-
function p(e) {
|
|
3
|
-
return !!e.cloneContents().querySelector(b);
|
|
4
|
-
}
|
|
5
|
-
function v(e, t) {
|
|
6
|
-
return (e?.nodeType === Node.ELEMENT_NODE ? e : e?.parentElement ?? null)?.closest('[contenteditable="true"]') || t()?.querySelector('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
|
|
7
|
-
}
|
|
8
|
-
function C(e, t) {
|
|
9
|
-
const n = v(e, t);
|
|
10
|
-
n && n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
11
|
-
}
|
|
12
|
-
function A(e, t) {
|
|
13
|
-
let r = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
|
|
14
|
-
for (; r && r !== document.body; ) {
|
|
15
|
-
if (r.classList.contains(t)) {
|
|
16
|
-
const c = document.createRange();
|
|
17
|
-
if (c.selectNodeContents(r), c.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && c.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
|
|
18
|
-
return r;
|
|
19
|
-
}
|
|
20
|
-
r = r.parentElement;
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function N(e) {
|
|
25
|
-
try {
|
|
26
|
-
if (e.savedRange) {
|
|
27
|
-
const o = window.getSelection();
|
|
28
|
-
o && (o.removeAllRanges(), o.addRange(e.savedRange.cloneRange()));
|
|
29
|
-
}
|
|
30
|
-
const t = window.getSelection();
|
|
31
|
-
if (!t || t.rangeCount === 0 || t.isCollapsed)
|
|
32
|
-
return !1;
|
|
33
|
-
const n = t.getRangeAt(0);
|
|
34
|
-
if (n.collapsed)
|
|
35
|
-
return !1;
|
|
36
|
-
const r = A(n, e.className);
|
|
37
|
-
if (r)
|
|
38
|
-
return e.styleProperty === "backgroundColor" ? r.style.backgroundColor = e.color : r.style.color = e.color, C(r, e.getActiveEditorRoot), !0;
|
|
39
|
-
v(
|
|
40
|
-
n.commonAncestorContainer,
|
|
41
|
-
e.getActiveEditorRoot
|
|
42
|
-
)?.focus({ preventScroll: !0 });
|
|
43
|
-
try {
|
|
44
|
-
document.execCommand("styleWithCSS", !1, "true");
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
let l = !1;
|
|
48
|
-
if (e.commands.forEach((o) => {
|
|
49
|
-
l || (l = document.execCommand(o, !1, e.color));
|
|
50
|
-
}), !l && !p(n)) {
|
|
51
|
-
const o = document.createElement("span");
|
|
52
|
-
e.styleProperty === "backgroundColor" ? o.style.backgroundColor = e.color : o.style.color = e.color, o.className = e.className;
|
|
53
|
-
const a = n.extractContents();
|
|
54
|
-
o.appendChild(a), n.insertNode(o), n.setStartAfter(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n), l = !0;
|
|
55
|
-
}
|
|
56
|
-
return l ? (C(n.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
|
|
57
|
-
} catch (t) {
|
|
58
|
-
return e.warnMessage ? console.error(e.warnMessage, t) : console.error("[ColorApply] Failed to apply color", t), !1;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function T({
|
|
62
|
-
popover: e,
|
|
63
|
-
anchor: t,
|
|
64
|
-
onClose: n,
|
|
65
|
-
gap: r = 6,
|
|
66
|
-
margin: c = 8,
|
|
67
|
-
zIndex: l = 1e4
|
|
68
|
-
}) {
|
|
69
|
-
e.style.position = "fixed", e.style.zIndex = `${l}`, e.style.visibility = "hidden";
|
|
70
|
-
const o = () => {
|
|
71
|
-
if (!e.isConnected || !t.isConnected) {
|
|
72
|
-
n();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const s = t.getBoundingClientRect();
|
|
76
|
-
if (s.width === 0 && s.height === 0) {
|
|
77
|
-
n();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const i = e.getBoundingClientRect(), w = i.width || e.offsetWidth || 220, f = i.height || e.offsetHeight || 260, y = window.innerWidth, E = window.innerHeight;
|
|
81
|
-
let u = s.left, d = s.bottom + r;
|
|
82
|
-
if (u + w > y - c && (u = y - w - c), u = Math.max(c, u), d + f > E - c) {
|
|
83
|
-
const g = s.top - f - r;
|
|
84
|
-
g >= c ? d = g : d = Math.max(c, E - f - c);
|
|
85
|
-
}
|
|
86
|
-
d < c && (d = c), e.style.left = `${Math.round(u)}px`, e.style.top = `${Math.round(d)}px`, e.style.visibility = "visible";
|
|
87
|
-
}, a = () => {
|
|
88
|
-
o();
|
|
89
|
-
}, m = (s) => {
|
|
90
|
-
const i = s.target;
|
|
91
|
-
i && (e.contains(i) || t.contains(i) || n());
|
|
92
|
-
}, h = (s) => {
|
|
93
|
-
s.key === "Escape" && n();
|
|
94
|
-
};
|
|
95
|
-
window.addEventListener("resize", a), window.addEventListener("scroll", a, !0), document.addEventListener("keydown", h);
|
|
96
|
-
const R = window.requestAnimationFrame(() => {
|
|
97
|
-
document.addEventListener("mousedown", m, !0);
|
|
98
|
-
});
|
|
99
|
-
return o(), { reposition: o, destroy: () => {
|
|
100
|
-
window.cancelAnimationFrame(R), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0), document.removeEventListener("keydown", h), document.removeEventListener("mousedown", m, !0);
|
|
101
|
-
} };
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
N as a,
|
|
105
|
-
T as b
|
|
106
|
-
};
|