tinymce-solid 0.0.7 → 0.0.9
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 +8 -6
- package/dist/dev.js +45 -24
- package/dist/dev.jsx +40 -27
- package/dist/index.js +35 -14
- package/dist/index.jsx +30 -17
- package/package.json +32 -23
- package/eslint.config.mjs +0 -5
- package/src/Events.ts +0 -93
- package/src/ScriptLoader2.ts +0 -176
- package/src/TinyMCE.ts +0 -8
- package/src/Utils.ts +0 -133
- package/src/components/Editor.tsx +0 -391
- package/src/components/EditorPropTypes.ts +0 -191
- package/src/index.tsx +0 -6
- package/tsconfig.json +0 -25
- package/tsup.config.ts +0 -40
package/README.md
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[<img width="100%" src="https://raw.githubusercontent.com/thednp/tinymce-solid/main/banner.svg" alt="TinyMCE Component for SolidJS">](https://thednp.github.io/tinymce-solid)
|
|
4
4
|
|
|
5
|
+
[](https://coveralls.io/github/thednp/tinymce-solid)
|
|
5
6
|
[](https://github.com/thednp/tinymce-solid/actions/workflows/ci.yml)
|
|
6
7
|
[](https://www.npmjs.com/package/tinymce-solid)
|
|
7
|
-
[](https://solidjs.com/)
|
|
9
|
+
[](https://www.tiny.cloud/)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
[](https://vitest.dev/)
|
|
12
|
+
[](https://github.com/vitejs)
|
|
12
13
|
|
|
13
14
|
## About
|
|
14
15
|
|
|
@@ -133,10 +134,11 @@ export default function App() {
|
|
|
133
134
|
- This package will automatically load the TinyMCE library and its dependencies by the use of the `tinymceScriptSrc` property;
|
|
134
135
|
- You can make use of the dark mode via TinyMCE skins: `skin="oxide-dark"` and `contentCss="dark"` properties, [the demo](https://thednp.github.io/tinymce-solid) is configured to make use of them via `createEffect`;
|
|
135
136
|
- Like the original React adaptation, this component allows you to hook into the TinyMCE instance via an `editorRef` reference.
|
|
137
|
+
- We've added tests powered by Vitest, with a real coverage of ~70%, that is becasue many branches cannot be covered in Vitest browser mode and playwright won't work in some Linux distributions for some reason.
|
|
136
138
|
|
|
137
139
|
## Issues
|
|
138
140
|
|
|
139
|
-
Have you found an issue with tinymce-solid or do you have a feature request? Open up an [issue](https://github.com/thednp/tinymce-solid/issues) and let us know or submit a [pull request](https://github.com/thednp/tinymce-solid/pulls).
|
|
141
|
+
Have you found an issue with **tinymce-solid** or do you have a feature request? Open up an [issue](https://github.com/thednp/tinymce-solid/issues) and let us know or submit a [pull request](https://github.com/thednp/tinymce-solid/pulls).
|
|
140
142
|
|
|
141
143
|
_Note: For issues concerning TinyMCE please visit the [TinyMCE repository](https://github.com/tinymce/tinymce)._
|
|
142
144
|
|
package/dist/dev.js
CHANGED
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// node_modules/react-is/cjs/react-is.development.js
|
|
30
|
+
// node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js
|
|
31
31
|
var require_react_is_development = __commonJS({
|
|
32
|
-
"node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
32
|
+
"node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
33
33
|
{
|
|
34
34
|
(function() {
|
|
35
35
|
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
@@ -180,18 +180,18 @@ var require_react_is_development = __commonJS({
|
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
// node_modules/react-is/index.js
|
|
183
|
+
// node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js
|
|
184
184
|
var require_react_is = __commonJS({
|
|
185
|
-
"node_modules/react-is/index.js"(exports, module) {
|
|
185
|
+
"node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js"(exports, module) {
|
|
186
186
|
{
|
|
187
187
|
module.exports = require_react_is_development();
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
// node_modules/object-assign/index.js
|
|
192
|
+
// node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js
|
|
193
193
|
var require_object_assign = __commonJS({
|
|
194
|
-
"node_modules/object-assign/index.js"(exports, module) {
|
|
194
|
+
"node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js"(exports, module) {
|
|
195
195
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
196
196
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
197
197
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
@@ -258,24 +258,24 @@ var require_object_assign = __commonJS({
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
|
|
261
|
-
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
261
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
262
262
|
var require_ReactPropTypesSecret = __commonJS({
|
|
263
|
-
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
263
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
264
264
|
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
265
265
|
module.exports = ReactPropTypesSecret;
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
// node_modules/prop-types/lib/has.js
|
|
269
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js
|
|
270
270
|
var require_has = __commonJS({
|
|
271
|
-
"node_modules/prop-types/lib/has.js"(exports, module) {
|
|
271
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js"(exports, module) {
|
|
272
272
|
module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
// node_modules/prop-types/checkPropTypes.js
|
|
276
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js
|
|
277
277
|
var require_checkPropTypes = __commonJS({
|
|
278
|
-
"node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
278
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
279
279
|
var printWarning = function() {
|
|
280
280
|
};
|
|
281
281
|
{
|
|
@@ -338,9 +338,9 @@ var require_checkPropTypes = __commonJS({
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
|
|
341
|
-
// node_modules/prop-types/factoryWithTypeCheckers.js
|
|
341
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js
|
|
342
342
|
var require_factoryWithTypeCheckers = __commonJS({
|
|
343
|
-
"node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
343
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
344
344
|
var ReactIs = require_react_is();
|
|
345
345
|
var assign = require_object_assign();
|
|
346
346
|
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
@@ -780,9 +780,9 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
780
780
|
}
|
|
781
781
|
});
|
|
782
782
|
|
|
783
|
-
// node_modules/prop-types/index.js
|
|
783
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js
|
|
784
784
|
var require_prop_types = __commonJS({
|
|
785
|
-
"node_modules/prop-types/index.js"(exports, module) {
|
|
785
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"(exports, module) {
|
|
786
786
|
{
|
|
787
787
|
ReactIs = require_react_is();
|
|
788
788
|
throwOnDirectAccess = true;
|
|
@@ -955,7 +955,7 @@ var normalizePluginArray = (plugins) => {
|
|
|
955
955
|
return Array.isArray(plugins) ? plugins : plugins.split(" ");
|
|
956
956
|
};
|
|
957
957
|
var mergePlugins = (initPlugins, inputPlugins) => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
|
|
958
|
-
var isBeforeInputEventAvailable = () =>
|
|
958
|
+
var isBeforeInputEventAvailable = () => globalThis.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
|
|
959
959
|
var isInDoc = (elem) => {
|
|
960
960
|
if (!("isConnected" in Node.prototype)) {
|
|
961
961
|
let current = elem;
|
|
@@ -1103,7 +1103,10 @@ var ScriptLoader = createScriptLoader();
|
|
|
1103
1103
|
// src/TinyMCE.ts
|
|
1104
1104
|
var getTinymce = (view) => {
|
|
1105
1105
|
const global = view;
|
|
1106
|
-
return global && global.tinymce ?
|
|
1106
|
+
return global && global.tinymce ? (
|
|
1107
|
+
/* istanbul ignore next -- @preserve */
|
|
1108
|
+
global.tinymce
|
|
1109
|
+
) : null;
|
|
1107
1110
|
};
|
|
1108
1111
|
|
|
1109
1112
|
// src/components/Editor.tsx
|
|
@@ -1120,7 +1123,8 @@ var Editor = (props) => {
|
|
|
1120
1123
|
const [rollbackTimer, setRollbackTimer] = createSignal();
|
|
1121
1124
|
const [valueCursor, setValueCursor] = createSignal();
|
|
1122
1125
|
const [boundHandlers, setBoundHandlers] = createSignal({});
|
|
1123
|
-
const view = () => props?.elementRef?.ownerDocument.defaultView ??
|
|
1126
|
+
const view = () => props?.elementRef?.ownerDocument.defaultView ?? /* istanbul ignore next @preserve */
|
|
1127
|
+
window;
|
|
1124
1128
|
const getInitialValue = () => {
|
|
1125
1129
|
if (typeof initialValue() === "string") {
|
|
1126
1130
|
return initialValue();
|
|
@@ -1325,7 +1329,8 @@ var Editor = (props) => {
|
|
|
1325
1329
|
const newContent = tinyEditor.getContent();
|
|
1326
1330
|
if (props.value !== void 0 && props.value !== newContent && props.rollback !== false) {
|
|
1327
1331
|
if (!rollbackTimer()) {
|
|
1328
|
-
|
|
1332
|
+
const newTimer = setTimeout(rollbackChange, typeof props.rollback === "number" ? props.rollback : 200);
|
|
1333
|
+
setRollbackTimer(newTimer);
|
|
1329
1334
|
}
|
|
1330
1335
|
}
|
|
1331
1336
|
if (newContent !== currentContent()) {
|
|
@@ -1345,7 +1350,7 @@ var Editor = (props) => {
|
|
|
1345
1350
|
if (valueCursor() && (!props.inline || tinyEditor.hasFocus())) {
|
|
1346
1351
|
try {
|
|
1347
1352
|
tinyEditor.selection.moveToBookmark(valueCursor());
|
|
1348
|
-
} catch (
|
|
1353
|
+
} catch (_e) {
|
|
1349
1354
|
}
|
|
1350
1355
|
}
|
|
1351
1356
|
});
|
|
@@ -1358,7 +1363,7 @@ var Editor = (props) => {
|
|
|
1358
1363
|
if (!props.inline || tinyEditor.hasFocus()) {
|
|
1359
1364
|
try {
|
|
1360
1365
|
setValueCursor(tinyEditor.selection.getBookmark(3));
|
|
1361
|
-
} catch (
|
|
1366
|
+
} catch (_e) {
|
|
1362
1367
|
}
|
|
1363
1368
|
}
|
|
1364
1369
|
}
|
|
@@ -1373,7 +1378,7 @@ var Editor = (props) => {
|
|
|
1373
1378
|
handleBeforeInput(evt);
|
|
1374
1379
|
}
|
|
1375
1380
|
};
|
|
1376
|
-
return createComponent(Dynamic, mergeProps({
|
|
1381
|
+
return createComponent(Dynamic, mergeProps(props, {
|
|
1377
1382
|
get component() {
|
|
1378
1383
|
return memo(() => !!props.inline)() ? tagName() : "textarea";
|
|
1379
1384
|
},
|
|
@@ -1389,12 +1394,28 @@ var Editor = (props) => {
|
|
|
1389
1394
|
ref(r$) {
|
|
1390
1395
|
var _ref$ = props.elementRef;
|
|
1391
1396
|
typeof _ref$ === "function" ? _ref$(r$) : props.elementRef = r$;
|
|
1397
|
+
},
|
|
1398
|
+
get ["data-disabled"]() {
|
|
1399
|
+
return disabled();
|
|
1400
|
+
},
|
|
1401
|
+
get ["data-skin"]() {
|
|
1402
|
+
return skin();
|
|
1403
|
+
},
|
|
1404
|
+
get ["data-css"]() {
|
|
1405
|
+
return contentCss();
|
|
1392
1406
|
}
|
|
1393
|
-
}
|
|
1407
|
+
}));
|
|
1394
1408
|
};
|
|
1395
1409
|
|
|
1396
1410
|
// src/index.tsx
|
|
1397
1411
|
var src_default = Editor;
|
|
1412
|
+
/* istanbul ignore next @preserve - this should be covered but the browser mode won't register this part */
|
|
1413
|
+
/* istanbul ignore next @preserve - this here seems to be for legacy browsers, we ignore it */
|
|
1414
|
+
/* istanbul ignore else @preserve */
|
|
1415
|
+
/* istanbul ignore next @preserve */
|
|
1416
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we ignore it */
|
|
1417
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we can ignore it */
|
|
1418
|
+
/* istanbul ignore next @preserve - exact same reason */
|
|
1398
1419
|
/*! Bundled license information:
|
|
1399
1420
|
|
|
1400
1421
|
react-is/cjs/react-is.development.js:
|
package/dist/dev.jsx
CHANGED
|
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
mod
|
|
25
25
|
));
|
|
26
26
|
|
|
27
|
-
// node_modules/react-is/cjs/react-is.development.js
|
|
27
|
+
// node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js
|
|
28
28
|
var require_react_is_development = __commonJS({
|
|
29
|
-
"node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
29
|
+
"node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
30
30
|
"use strict";
|
|
31
31
|
if (true) {
|
|
32
32
|
(function() {
|
|
@@ -179,9 +179,9 @@ var require_react_is_development = __commonJS({
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
// node_modules/react-is/index.js
|
|
182
|
+
// node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js
|
|
183
183
|
var require_react_is = __commonJS({
|
|
184
|
-
"node_modules/react-is/index.js"(exports, module) {
|
|
184
|
+
"node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js"(exports, module) {
|
|
185
185
|
"use strict";
|
|
186
186
|
if (false) {
|
|
187
187
|
module.exports = null;
|
|
@@ -191,9 +191,9 @@ var require_react_is = __commonJS({
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
// node_modules/object-assign/index.js
|
|
194
|
+
// node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js
|
|
195
195
|
var require_object_assign = __commonJS({
|
|
196
|
-
"node_modules/object-assign/index.js"(exports, module) {
|
|
196
|
+
"node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js"(exports, module) {
|
|
197
197
|
"use strict";
|
|
198
198
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
199
199
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -261,26 +261,26 @@ var require_object_assign = __commonJS({
|
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
|
|
264
|
-
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
264
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
265
265
|
var require_ReactPropTypesSecret = __commonJS({
|
|
266
|
-
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
266
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
267
267
|
"use strict";
|
|
268
268
|
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
269
269
|
module.exports = ReactPropTypesSecret;
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
272
|
|
|
273
|
-
// node_modules/prop-types/lib/has.js
|
|
273
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js
|
|
274
274
|
var require_has = __commonJS({
|
|
275
|
-
"node_modules/prop-types/lib/has.js"(exports, module) {
|
|
275
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js"(exports, module) {
|
|
276
276
|
"use strict";
|
|
277
277
|
module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
|
|
281
|
-
// node_modules/prop-types/checkPropTypes.js
|
|
281
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js
|
|
282
282
|
var require_checkPropTypes = __commonJS({
|
|
283
|
-
"node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
283
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
284
284
|
"use strict";
|
|
285
285
|
var printWarning = function() {
|
|
286
286
|
};
|
|
@@ -344,9 +344,9 @@ var require_checkPropTypes = __commonJS({
|
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
-
// node_modules/prop-types/factoryWithTypeCheckers.js
|
|
347
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js
|
|
348
348
|
var require_factoryWithTypeCheckers = __commonJS({
|
|
349
|
-
"node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
349
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
350
350
|
"use strict";
|
|
351
351
|
var ReactIs = require_react_is();
|
|
352
352
|
var assign = require_object_assign();
|
|
@@ -787,9 +787,9 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
787
787
|
}
|
|
788
788
|
});
|
|
789
789
|
|
|
790
|
-
// node_modules/prop-types/index.js
|
|
790
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js
|
|
791
791
|
var require_prop_types = __commonJS({
|
|
792
|
-
"node_modules/prop-types/index.js"(exports, module) {
|
|
792
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"(exports, module) {
|
|
793
793
|
"use strict";
|
|
794
794
|
if (true) {
|
|
795
795
|
ReactIs = require_react_is();
|
|
@@ -969,7 +969,7 @@ var normalizePluginArray = (plugins) => {
|
|
|
969
969
|
return Array.isArray(plugins) ? plugins : plugins.split(" ");
|
|
970
970
|
};
|
|
971
971
|
var mergePlugins = (initPlugins, inputPlugins) => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
|
|
972
|
-
var isBeforeInputEventAvailable = () =>
|
|
972
|
+
var isBeforeInputEventAvailable = () => globalThis.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
|
|
973
973
|
var isInDoc = (elem) => {
|
|
974
974
|
if (!("isConnected" in Node.prototype)) {
|
|
975
975
|
let current = elem;
|
|
@@ -1117,7 +1117,10 @@ var ScriptLoader = createScriptLoader();
|
|
|
1117
1117
|
// src/TinyMCE.ts
|
|
1118
1118
|
var getTinymce = (view) => {
|
|
1119
1119
|
const global = view;
|
|
1120
|
-
return global && global.tinymce ?
|
|
1120
|
+
return global && global.tinymce ? (
|
|
1121
|
+
/* istanbul ignore next -- @preserve */
|
|
1122
|
+
global.tinymce
|
|
1123
|
+
) : null;
|
|
1121
1124
|
};
|
|
1122
1125
|
|
|
1123
1126
|
// src/components/Editor.tsx
|
|
@@ -1134,7 +1137,8 @@ var Editor = (props) => {
|
|
|
1134
1137
|
const [rollbackTimer, setRollbackTimer] = createSignal();
|
|
1135
1138
|
const [valueCursor, setValueCursor] = createSignal();
|
|
1136
1139
|
const [boundHandlers, setBoundHandlers] = createSignal({});
|
|
1137
|
-
const view = () => props?.elementRef?.ownerDocument.defaultView ??
|
|
1140
|
+
const view = () => props?.elementRef?.ownerDocument.defaultView ?? /* istanbul ignore next @preserve */
|
|
1141
|
+
window;
|
|
1138
1142
|
const getInitialValue = () => {
|
|
1139
1143
|
if (typeof initialValue() === "string") {
|
|
1140
1144
|
return initialValue();
|
|
@@ -1344,12 +1348,11 @@ var Editor = (props) => {
|
|
|
1344
1348
|
const newContent = tinyEditor.getContent();
|
|
1345
1349
|
if (props.value !== void 0 && props.value !== newContent && props.rollback !== false) {
|
|
1346
1350
|
if (!rollbackTimer()) {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
typeof props.rollback === "number" ? props.rollback : 200
|
|
1351
|
-
)
|
|
1351
|
+
const newTimer = setTimeout(
|
|
1352
|
+
rollbackChange,
|
|
1353
|
+
typeof props.rollback === "number" ? props.rollback : 200
|
|
1352
1354
|
);
|
|
1355
|
+
setRollbackTimer(newTimer);
|
|
1353
1356
|
}
|
|
1354
1357
|
}
|
|
1355
1358
|
if (newContent !== currentContent()) {
|
|
@@ -1369,7 +1372,7 @@ var Editor = (props) => {
|
|
|
1369
1372
|
if (valueCursor() && (!props.inline || tinyEditor.hasFocus())) {
|
|
1370
1373
|
try {
|
|
1371
1374
|
tinyEditor.selection.moveToBookmark(valueCursor());
|
|
1372
|
-
} catch (
|
|
1375
|
+
} catch (_e) {
|
|
1373
1376
|
}
|
|
1374
1377
|
}
|
|
1375
1378
|
});
|
|
@@ -1382,7 +1385,7 @@ var Editor = (props) => {
|
|
|
1382
1385
|
if (!props.inline || tinyEditor.hasFocus()) {
|
|
1383
1386
|
try {
|
|
1384
1387
|
setValueCursor(tinyEditor.selection.getBookmark(3));
|
|
1385
|
-
} catch (
|
|
1388
|
+
} catch (_e) {
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
1388
1391
|
}
|
|
@@ -1398,12 +1401,15 @@ var Editor = (props) => {
|
|
|
1398
1401
|
}
|
|
1399
1402
|
};
|
|
1400
1403
|
return <Dynamic
|
|
1404
|
+
{...props}
|
|
1401
1405
|
component={props.inline ? tagName() : "textarea"}
|
|
1402
1406
|
id={id()}
|
|
1403
1407
|
data-testid={props.testid}
|
|
1404
1408
|
tabIndex={props.tabIndex}
|
|
1405
1409
|
ref={props.elementRef}
|
|
1406
|
-
{
|
|
1410
|
+
data-disabled={disabled()}
|
|
1411
|
+
data-skin={skin()}
|
|
1412
|
+
data-css={contentCss()}
|
|
1407
1413
|
/>;
|
|
1408
1414
|
};
|
|
1409
1415
|
|
|
@@ -1413,6 +1419,13 @@ export {
|
|
|
1413
1419
|
EditorPropTypes,
|
|
1414
1420
|
src_default as default
|
|
1415
1421
|
};
|
|
1422
|
+
/* istanbul ignore next @preserve - this should be covered but the browser mode won't register this part */
|
|
1423
|
+
/* istanbul ignore next @preserve - this here seems to be for legacy browsers, we ignore it */
|
|
1424
|
+
/* istanbul ignore else @preserve */
|
|
1425
|
+
/* istanbul ignore next @preserve */
|
|
1426
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we ignore it */
|
|
1427
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we can ignore it */
|
|
1428
|
+
/* istanbul ignore next @preserve - exact same reason */
|
|
1416
1429
|
/*! Bundled license information:
|
|
1417
1430
|
|
|
1418
1431
|
react-is/cjs/react-is.development.js:
|
package/dist/index.js
CHANGED
|
@@ -27,17 +27,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
30
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
31
31
|
var require_ReactPropTypesSecret = __commonJS({
|
|
32
|
-
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
32
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
33
33
|
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
34
34
|
module.exports = ReactPropTypesSecret;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
// node_modules/prop-types/factoryWithThrowingShims.js
|
|
38
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js
|
|
39
39
|
var require_factoryWithThrowingShims = __commonJS({
|
|
40
|
-
"node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
40
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
41
41
|
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
42
42
|
function emptyFunction() {
|
|
43
43
|
}
|
|
@@ -88,9 +88,9 @@ var require_factoryWithThrowingShims = __commonJS({
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
// node_modules/prop-types/index.js
|
|
91
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js
|
|
92
92
|
var require_prop_types = __commonJS({
|
|
93
|
-
"node_modules/prop-types/index.js"(exports, module) {
|
|
93
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"(exports, module) {
|
|
94
94
|
{
|
|
95
95
|
module.exports = require_factoryWithThrowingShims()();
|
|
96
96
|
}
|
|
@@ -259,7 +259,7 @@ var normalizePluginArray = (plugins) => {
|
|
|
259
259
|
return Array.isArray(plugins) ? plugins : plugins.split(" ");
|
|
260
260
|
};
|
|
261
261
|
var mergePlugins = (initPlugins, inputPlugins) => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
|
|
262
|
-
var isBeforeInputEventAvailable = () =>
|
|
262
|
+
var isBeforeInputEventAvailable = () => globalThis.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
|
|
263
263
|
var isInDoc = (elem) => {
|
|
264
264
|
if (!("isConnected" in Node.prototype)) {
|
|
265
265
|
let current = elem;
|
|
@@ -407,7 +407,10 @@ var ScriptLoader = createScriptLoader();
|
|
|
407
407
|
// src/TinyMCE.ts
|
|
408
408
|
var getTinymce = (view) => {
|
|
409
409
|
const global = view;
|
|
410
|
-
return global && global.tinymce ?
|
|
410
|
+
return global && global.tinymce ? (
|
|
411
|
+
/* istanbul ignore next -- @preserve */
|
|
412
|
+
global.tinymce
|
|
413
|
+
) : null;
|
|
411
414
|
};
|
|
412
415
|
|
|
413
416
|
// src/components/Editor.tsx
|
|
@@ -424,7 +427,8 @@ var Editor = (props) => {
|
|
|
424
427
|
const [rollbackTimer, setRollbackTimer] = createSignal();
|
|
425
428
|
const [valueCursor, setValueCursor] = createSignal();
|
|
426
429
|
const [boundHandlers, setBoundHandlers] = createSignal({});
|
|
427
|
-
const view = () => props?.elementRef?.ownerDocument.defaultView ??
|
|
430
|
+
const view = () => props?.elementRef?.ownerDocument.defaultView ?? /* istanbul ignore next @preserve */
|
|
431
|
+
window;
|
|
428
432
|
const getInitialValue = () => {
|
|
429
433
|
if (typeof initialValue() === "string") {
|
|
430
434
|
return initialValue();
|
|
@@ -629,7 +633,8 @@ var Editor = (props) => {
|
|
|
629
633
|
const newContent = tinyEditor.getContent();
|
|
630
634
|
if (props.value !== void 0 && props.value !== newContent && props.rollback !== false) {
|
|
631
635
|
if (!rollbackTimer()) {
|
|
632
|
-
|
|
636
|
+
const newTimer = setTimeout(rollbackChange, typeof props.rollback === "number" ? props.rollback : 200);
|
|
637
|
+
setRollbackTimer(newTimer);
|
|
633
638
|
}
|
|
634
639
|
}
|
|
635
640
|
if (newContent !== currentContent()) {
|
|
@@ -649,7 +654,7 @@ var Editor = (props) => {
|
|
|
649
654
|
if (valueCursor() && (!props.inline || tinyEditor.hasFocus())) {
|
|
650
655
|
try {
|
|
651
656
|
tinyEditor.selection.moveToBookmark(valueCursor());
|
|
652
|
-
} catch (
|
|
657
|
+
} catch (_e) {
|
|
653
658
|
}
|
|
654
659
|
}
|
|
655
660
|
});
|
|
@@ -662,7 +667,7 @@ var Editor = (props) => {
|
|
|
662
667
|
if (!props.inline || tinyEditor.hasFocus()) {
|
|
663
668
|
try {
|
|
664
669
|
setValueCursor(tinyEditor.selection.getBookmark(3));
|
|
665
|
-
} catch (
|
|
670
|
+
} catch (_e) {
|
|
666
671
|
}
|
|
667
672
|
}
|
|
668
673
|
}
|
|
@@ -677,7 +682,7 @@ var Editor = (props) => {
|
|
|
677
682
|
handleBeforeInput(evt);
|
|
678
683
|
}
|
|
679
684
|
};
|
|
680
|
-
return createComponent(Dynamic, mergeProps({
|
|
685
|
+
return createComponent(Dynamic, mergeProps(props, {
|
|
681
686
|
get component() {
|
|
682
687
|
return memo(() => !!props.inline)() ? tagName() : "textarea";
|
|
683
688
|
},
|
|
@@ -693,11 +698,27 @@ var Editor = (props) => {
|
|
|
693
698
|
ref(r$) {
|
|
694
699
|
var _ref$ = props.elementRef;
|
|
695
700
|
typeof _ref$ === "function" ? _ref$(r$) : props.elementRef = r$;
|
|
701
|
+
},
|
|
702
|
+
get ["data-disabled"]() {
|
|
703
|
+
return disabled();
|
|
704
|
+
},
|
|
705
|
+
get ["data-skin"]() {
|
|
706
|
+
return skin();
|
|
707
|
+
},
|
|
708
|
+
get ["data-css"]() {
|
|
709
|
+
return contentCss();
|
|
696
710
|
}
|
|
697
|
-
}
|
|
711
|
+
}));
|
|
698
712
|
};
|
|
699
713
|
|
|
700
714
|
// src/index.tsx
|
|
701
715
|
var src_default = Editor;
|
|
716
|
+
/* istanbul ignore next @preserve - this should be covered but the browser mode won't register this part */
|
|
717
|
+
/* istanbul ignore next @preserve - this here seems to be for legacy browsers, we ignore it */
|
|
718
|
+
/* istanbul ignore else @preserve */
|
|
719
|
+
/* istanbul ignore next @preserve */
|
|
720
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we ignore it */
|
|
721
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we can ignore it */
|
|
722
|
+
/* istanbul ignore next @preserve - exact same reason */
|
|
702
723
|
|
|
703
724
|
export { EditorPropTypes, src_default as default };
|
package/dist/index.jsx
CHANGED
|
@@ -24,18 +24,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
mod
|
|
25
25
|
));
|
|
26
26
|
|
|
27
|
-
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
27
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
28
28
|
var require_ReactPropTypesSecret = __commonJS({
|
|
29
|
-
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
29
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
30
30
|
"use strict";
|
|
31
31
|
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
32
32
|
module.exports = ReactPropTypesSecret;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
// node_modules/prop-types/factoryWithThrowingShims.js
|
|
36
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js
|
|
37
37
|
var require_factoryWithThrowingShims = __commonJS({
|
|
38
|
-
"node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
38
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
|
|
39
39
|
"use strict";
|
|
40
40
|
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
41
41
|
function emptyFunction() {
|
|
@@ -89,9 +89,9 @@ var require_factoryWithThrowingShims = __commonJS({
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// node_modules/prop-types/index.js
|
|
92
|
+
// node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js
|
|
93
93
|
var require_prop_types = __commonJS({
|
|
94
|
-
"node_modules/prop-types/index.js"(exports, module) {
|
|
94
|
+
"node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"(exports, module) {
|
|
95
95
|
"use strict";
|
|
96
96
|
if (false) {
|
|
97
97
|
ReactIs = null;
|
|
@@ -271,7 +271,7 @@ var normalizePluginArray = (plugins) => {
|
|
|
271
271
|
return Array.isArray(plugins) ? plugins : plugins.split(" ");
|
|
272
272
|
};
|
|
273
273
|
var mergePlugins = (initPlugins, inputPlugins) => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
|
|
274
|
-
var isBeforeInputEventAvailable = () =>
|
|
274
|
+
var isBeforeInputEventAvailable = () => globalThis.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
|
|
275
275
|
var isInDoc = (elem) => {
|
|
276
276
|
if (!("isConnected" in Node.prototype)) {
|
|
277
277
|
let current = elem;
|
|
@@ -419,7 +419,10 @@ var ScriptLoader = createScriptLoader();
|
|
|
419
419
|
// src/TinyMCE.ts
|
|
420
420
|
var getTinymce = (view) => {
|
|
421
421
|
const global = view;
|
|
422
|
-
return global && global.tinymce ?
|
|
422
|
+
return global && global.tinymce ? (
|
|
423
|
+
/* istanbul ignore next -- @preserve */
|
|
424
|
+
global.tinymce
|
|
425
|
+
) : null;
|
|
423
426
|
};
|
|
424
427
|
|
|
425
428
|
// src/components/Editor.tsx
|
|
@@ -436,7 +439,8 @@ var Editor = (props) => {
|
|
|
436
439
|
const [rollbackTimer, setRollbackTimer] = createSignal();
|
|
437
440
|
const [valueCursor, setValueCursor] = createSignal();
|
|
438
441
|
const [boundHandlers, setBoundHandlers] = createSignal({});
|
|
439
|
-
const view = () => props?.elementRef?.ownerDocument.defaultView ??
|
|
442
|
+
const view = () => props?.elementRef?.ownerDocument.defaultView ?? /* istanbul ignore next @preserve */
|
|
443
|
+
window;
|
|
440
444
|
const getInitialValue = () => {
|
|
441
445
|
if (typeof initialValue() === "string") {
|
|
442
446
|
return initialValue();
|
|
@@ -646,12 +650,11 @@ var Editor = (props) => {
|
|
|
646
650
|
const newContent = tinyEditor.getContent();
|
|
647
651
|
if (props.value !== void 0 && props.value !== newContent && props.rollback !== false) {
|
|
648
652
|
if (!rollbackTimer()) {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
typeof props.rollback === "number" ? props.rollback : 200
|
|
653
|
-
)
|
|
653
|
+
const newTimer = setTimeout(
|
|
654
|
+
rollbackChange,
|
|
655
|
+
typeof props.rollback === "number" ? props.rollback : 200
|
|
654
656
|
);
|
|
657
|
+
setRollbackTimer(newTimer);
|
|
655
658
|
}
|
|
656
659
|
}
|
|
657
660
|
if (newContent !== currentContent()) {
|
|
@@ -671,7 +674,7 @@ var Editor = (props) => {
|
|
|
671
674
|
if (valueCursor() && (!props.inline || tinyEditor.hasFocus())) {
|
|
672
675
|
try {
|
|
673
676
|
tinyEditor.selection.moveToBookmark(valueCursor());
|
|
674
|
-
} catch (
|
|
677
|
+
} catch (_e) {
|
|
675
678
|
}
|
|
676
679
|
}
|
|
677
680
|
});
|
|
@@ -684,7 +687,7 @@ var Editor = (props) => {
|
|
|
684
687
|
if (!props.inline || tinyEditor.hasFocus()) {
|
|
685
688
|
try {
|
|
686
689
|
setValueCursor(tinyEditor.selection.getBookmark(3));
|
|
687
|
-
} catch (
|
|
690
|
+
} catch (_e) {
|
|
688
691
|
}
|
|
689
692
|
}
|
|
690
693
|
}
|
|
@@ -700,12 +703,15 @@ var Editor = (props) => {
|
|
|
700
703
|
}
|
|
701
704
|
};
|
|
702
705
|
return <Dynamic
|
|
706
|
+
{...props}
|
|
703
707
|
component={props.inline ? tagName() : "textarea"}
|
|
704
708
|
id={id()}
|
|
705
709
|
data-testid={props.testid}
|
|
706
710
|
tabIndex={props.tabIndex}
|
|
707
711
|
ref={props.elementRef}
|
|
708
|
-
{
|
|
712
|
+
data-disabled={disabled()}
|
|
713
|
+
data-skin={skin()}
|
|
714
|
+
data-css={contentCss()}
|
|
709
715
|
/>;
|
|
710
716
|
};
|
|
711
717
|
|
|
@@ -715,3 +721,10 @@ export {
|
|
|
715
721
|
EditorPropTypes,
|
|
716
722
|
src_default as default
|
|
717
723
|
};
|
|
724
|
+
/* istanbul ignore next @preserve - this should be covered but the browser mode won't register this part */
|
|
725
|
+
/* istanbul ignore next @preserve - this here seems to be for legacy browsers, we ignore it */
|
|
726
|
+
/* istanbul ignore else @preserve */
|
|
727
|
+
/* istanbul ignore next @preserve */
|
|
728
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we ignore it */
|
|
729
|
+
/* istanbul ignore next @preserve - this error is thrown on every HMR so we can ignore it */
|
|
730
|
+
/* istanbul ignore next @preserve - exact same reason */
|