tinymce-solid 0.0.2 → 0.0.4
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 -16
- package/components.json +2 -2
- package/dist/dev.jsx +609 -17
- package/dist/{dev.js → dev.mjs} +610 -33
- package/dist/index.jsx +26 -15
- package/dist/{index.js → index.mjs} +608 -31
- package/package.json +15 -7
- package/src/TinyMCE.ts +1 -1
- package/src/components/SolidEditor.tsx +28 -23
- package/tailwind.config.js +53 -0
- package/tsconfig.json +1 -0
- package/tsup.config.ts +0 -2
- package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -31
- package/.github/ISSUE_TEMPLATE/feature-request.yml +0 -27
- package/.github/codeql/codeql-config.yml +0 -2
- package/.github/workflows/badges.yml +0 -30
- package/.github/workflows/ci.yml +0 -47
- package/.github/workflows/codeql.yml +0 -75
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { use, effect, setAttribute, template } from 'solid-js/web';
|
|
2
|
-
import { createSignal, createEffect, on, onMount, onCleanup } from 'solid-js';
|
|
3
|
-
|
|
4
1
|
var __create = Object.create;
|
|
5
2
|
var __defProp = Object.defineProperty;
|
|
6
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -97,6 +94,581 @@ var require_prop_types = __commonJS({
|
|
|
97
94
|
}
|
|
98
95
|
});
|
|
99
96
|
|
|
97
|
+
// node_modules/solid-js/dist/solid.js
|
|
98
|
+
var sharedConfig = {
|
|
99
|
+
context: void 0,
|
|
100
|
+
registry: void 0
|
|
101
|
+
};
|
|
102
|
+
function setHydrateContext(context) {
|
|
103
|
+
sharedConfig.context = context;
|
|
104
|
+
}
|
|
105
|
+
var equalFn = (a, b) => a === b;
|
|
106
|
+
var signalOptions = {
|
|
107
|
+
equals: equalFn
|
|
108
|
+
};
|
|
109
|
+
var ERROR = null;
|
|
110
|
+
var runEffects = runQueue;
|
|
111
|
+
var STALE = 1;
|
|
112
|
+
var PENDING = 2;
|
|
113
|
+
var UNOWNED = {
|
|
114
|
+
owned: null,
|
|
115
|
+
cleanups: null,
|
|
116
|
+
context: null,
|
|
117
|
+
owner: null
|
|
118
|
+
};
|
|
119
|
+
var Owner = null;
|
|
120
|
+
var Transition = null;
|
|
121
|
+
var Scheduler = null;
|
|
122
|
+
var ExternalSourceConfig = null;
|
|
123
|
+
var Listener = null;
|
|
124
|
+
var Updates = null;
|
|
125
|
+
var Effects = null;
|
|
126
|
+
var ExecCount = 0;
|
|
127
|
+
function createSignal(value, options) {
|
|
128
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
129
|
+
const s = {
|
|
130
|
+
value,
|
|
131
|
+
observers: null,
|
|
132
|
+
observerSlots: null,
|
|
133
|
+
comparator: options.equals || void 0
|
|
134
|
+
};
|
|
135
|
+
const setter = (value2) => {
|
|
136
|
+
if (typeof value2 === "function") {
|
|
137
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
|
|
138
|
+
else value2 = value2(s.value);
|
|
139
|
+
}
|
|
140
|
+
return writeSignal(s, value2);
|
|
141
|
+
};
|
|
142
|
+
return [readSignal.bind(s), setter];
|
|
143
|
+
}
|
|
144
|
+
function createRenderEffect(fn, value, options) {
|
|
145
|
+
const c = createComputation(fn, value, false, STALE);
|
|
146
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
147
|
+
else updateComputation(c);
|
|
148
|
+
}
|
|
149
|
+
function createEffect(fn, value, options) {
|
|
150
|
+
runEffects = runUserEffects;
|
|
151
|
+
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
152
|
+
if (s) c.suspense = s;
|
|
153
|
+
c.user = true;
|
|
154
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
155
|
+
}
|
|
156
|
+
function untrack(fn) {
|
|
157
|
+
if (!ExternalSourceConfig && Listener === null) return fn();
|
|
158
|
+
const listener = Listener;
|
|
159
|
+
Listener = null;
|
|
160
|
+
try {
|
|
161
|
+
if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
|
|
162
|
+
return fn();
|
|
163
|
+
} finally {
|
|
164
|
+
Listener = listener;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function on(deps, fn, options) {
|
|
168
|
+
const isArray = Array.isArray(deps);
|
|
169
|
+
let prevInput;
|
|
170
|
+
return (prevValue) => {
|
|
171
|
+
let input;
|
|
172
|
+
if (isArray) {
|
|
173
|
+
input = Array(deps.length);
|
|
174
|
+
for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
|
|
175
|
+
} else input = deps();
|
|
176
|
+
const result = untrack(() => fn(input, prevInput, prevValue));
|
|
177
|
+
prevInput = input;
|
|
178
|
+
return result;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function onMount(fn) {
|
|
182
|
+
createEffect(() => untrack(fn));
|
|
183
|
+
}
|
|
184
|
+
function onCleanup(fn) {
|
|
185
|
+
if (Owner === null) ;
|
|
186
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
187
|
+
else Owner.cleanups.push(fn);
|
|
188
|
+
return fn;
|
|
189
|
+
}
|
|
190
|
+
function startTransition(fn) {
|
|
191
|
+
if (Transition && Transition.running) {
|
|
192
|
+
fn();
|
|
193
|
+
return Transition.done;
|
|
194
|
+
}
|
|
195
|
+
const l = Listener;
|
|
196
|
+
const o = Owner;
|
|
197
|
+
return Promise.resolve().then(() => {
|
|
198
|
+
Listener = l;
|
|
199
|
+
Owner = o;
|
|
200
|
+
let t;
|
|
201
|
+
if (Scheduler || SuspenseContext) {
|
|
202
|
+
t = Transition || (Transition = {
|
|
203
|
+
sources: /* @__PURE__ */ new Set(),
|
|
204
|
+
effects: [],
|
|
205
|
+
promises: /* @__PURE__ */ new Set(),
|
|
206
|
+
disposed: /* @__PURE__ */ new Set(),
|
|
207
|
+
queue: /* @__PURE__ */ new Set(),
|
|
208
|
+
running: true
|
|
209
|
+
});
|
|
210
|
+
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
211
|
+
t.running = true;
|
|
212
|
+
}
|
|
213
|
+
runUpdates(fn);
|
|
214
|
+
Listener = Owner = null;
|
|
215
|
+
return t ? t.done : void 0;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
219
|
+
function useContext(context) {
|
|
220
|
+
return Owner && Owner.context && Owner.context[context.id] !== void 0 ? Owner.context[context.id] : context.defaultValue;
|
|
221
|
+
}
|
|
222
|
+
var SuspenseContext;
|
|
223
|
+
function readSignal() {
|
|
224
|
+
const runningTransition = Transition && Transition.running;
|
|
225
|
+
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
226
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
227
|
+
else {
|
|
228
|
+
const updates = Updates;
|
|
229
|
+
Updates = null;
|
|
230
|
+
runUpdates(() => lookUpstream(this));
|
|
231
|
+
Updates = updates;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (Listener) {
|
|
235
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
236
|
+
if (!Listener.sources) {
|
|
237
|
+
Listener.sources = [this];
|
|
238
|
+
Listener.sourceSlots = [sSlot];
|
|
239
|
+
} else {
|
|
240
|
+
Listener.sources.push(this);
|
|
241
|
+
Listener.sourceSlots.push(sSlot);
|
|
242
|
+
}
|
|
243
|
+
if (!this.observers) {
|
|
244
|
+
this.observers = [Listener];
|
|
245
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
246
|
+
} else {
|
|
247
|
+
this.observers.push(Listener);
|
|
248
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
252
|
+
return this.value;
|
|
253
|
+
}
|
|
254
|
+
function writeSignal(node, value, isComp) {
|
|
255
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
256
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
257
|
+
if (Transition) {
|
|
258
|
+
const TransitionRunning = Transition.running;
|
|
259
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
260
|
+
Transition.sources.add(node);
|
|
261
|
+
node.tValue = value;
|
|
262
|
+
}
|
|
263
|
+
if (!TransitionRunning) node.value = value;
|
|
264
|
+
} else node.value = value;
|
|
265
|
+
if (node.observers && node.observers.length) {
|
|
266
|
+
runUpdates(() => {
|
|
267
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
268
|
+
const o = node.observers[i];
|
|
269
|
+
const TransitionRunning = Transition && Transition.running;
|
|
270
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
271
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
272
|
+
if (o.pure) Updates.push(o);
|
|
273
|
+
else Effects.push(o);
|
|
274
|
+
if (o.observers) markDownstream(o);
|
|
275
|
+
}
|
|
276
|
+
if (!TransitionRunning) o.state = STALE;
|
|
277
|
+
else o.tState = STALE;
|
|
278
|
+
}
|
|
279
|
+
if (Updates.length > 1e6) {
|
|
280
|
+
Updates = [];
|
|
281
|
+
if (false) ;
|
|
282
|
+
throw new Error();
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
289
|
+
function updateComputation(node) {
|
|
290
|
+
if (!node.fn) return;
|
|
291
|
+
cleanNode(node);
|
|
292
|
+
const time = ExecCount;
|
|
293
|
+
runComputation(
|
|
294
|
+
node,
|
|
295
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
296
|
+
time
|
|
297
|
+
);
|
|
298
|
+
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
299
|
+
queueMicrotask(() => {
|
|
300
|
+
runUpdates(() => {
|
|
301
|
+
Transition && (Transition.running = true);
|
|
302
|
+
Listener = Owner = node;
|
|
303
|
+
runComputation(node, node.tValue, time);
|
|
304
|
+
Listener = Owner = null;
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function runComputation(node, value, time) {
|
|
310
|
+
let nextValue;
|
|
311
|
+
const owner = Owner, listener = Listener;
|
|
312
|
+
Listener = Owner = node;
|
|
313
|
+
try {
|
|
314
|
+
nextValue = node.fn(value);
|
|
315
|
+
} catch (err) {
|
|
316
|
+
if (node.pure) {
|
|
317
|
+
if (Transition && Transition.running) {
|
|
318
|
+
node.tState = STALE;
|
|
319
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
320
|
+
node.tOwned = void 0;
|
|
321
|
+
} else {
|
|
322
|
+
node.state = STALE;
|
|
323
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
324
|
+
node.owned = null;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
node.updatedAt = time + 1;
|
|
328
|
+
return handleError(err);
|
|
329
|
+
} finally {
|
|
330
|
+
Listener = listener;
|
|
331
|
+
Owner = owner;
|
|
332
|
+
}
|
|
333
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
334
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
335
|
+
writeSignal(node, nextValue, true);
|
|
336
|
+
} else if (Transition && Transition.running && node.pure) {
|
|
337
|
+
Transition.sources.add(node);
|
|
338
|
+
node.tValue = nextValue;
|
|
339
|
+
} else node.value = nextValue;
|
|
340
|
+
node.updatedAt = time;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
344
|
+
const c = {
|
|
345
|
+
fn,
|
|
346
|
+
state,
|
|
347
|
+
updatedAt: null,
|
|
348
|
+
owned: null,
|
|
349
|
+
sources: null,
|
|
350
|
+
sourceSlots: null,
|
|
351
|
+
cleanups: null,
|
|
352
|
+
value: init,
|
|
353
|
+
owner: Owner,
|
|
354
|
+
context: Owner ? Owner.context : null,
|
|
355
|
+
pure
|
|
356
|
+
};
|
|
357
|
+
if (Transition && Transition.running) {
|
|
358
|
+
c.state = 0;
|
|
359
|
+
c.tState = state;
|
|
360
|
+
}
|
|
361
|
+
if (Owner === null) ;
|
|
362
|
+
else if (Owner !== UNOWNED) {
|
|
363
|
+
if (Transition && Transition.running && Owner.pure) {
|
|
364
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
365
|
+
else Owner.tOwned.push(c);
|
|
366
|
+
} else {
|
|
367
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
368
|
+
else Owner.owned.push(c);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (ExternalSourceConfig && c.fn) {
|
|
372
|
+
const [track, trigger] = createSignal(void 0, {
|
|
373
|
+
equals: false
|
|
374
|
+
});
|
|
375
|
+
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
376
|
+
onCleanup(() => ordinary.dispose());
|
|
377
|
+
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
378
|
+
const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
|
|
379
|
+
c.fn = (x) => {
|
|
380
|
+
track();
|
|
381
|
+
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
return c;
|
|
385
|
+
}
|
|
386
|
+
function runTop(node) {
|
|
387
|
+
const runningTransition = Transition && Transition.running;
|
|
388
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
389
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
390
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
391
|
+
const ancestors = [node];
|
|
392
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
393
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
394
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
395
|
+
}
|
|
396
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
397
|
+
node = ancestors[i];
|
|
398
|
+
if (runningTransition) {
|
|
399
|
+
let top = node, prev = ancestors[i + 1];
|
|
400
|
+
while ((top = top.owner) && top !== prev) {
|
|
401
|
+
if (Transition.disposed.has(top)) return;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if ((runningTransition ? node.tState : node.state) === STALE) {
|
|
405
|
+
updateComputation(node);
|
|
406
|
+
} else if ((runningTransition ? node.tState : node.state) === PENDING) {
|
|
407
|
+
const updates = Updates;
|
|
408
|
+
Updates = null;
|
|
409
|
+
runUpdates(() => lookUpstream(node, ancestors[0]));
|
|
410
|
+
Updates = updates;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function runUpdates(fn, init) {
|
|
415
|
+
if (Updates) return fn();
|
|
416
|
+
let wait = false;
|
|
417
|
+
Updates = [];
|
|
418
|
+
if (Effects) wait = true;
|
|
419
|
+
else Effects = [];
|
|
420
|
+
ExecCount++;
|
|
421
|
+
try {
|
|
422
|
+
const res = fn();
|
|
423
|
+
completeUpdates(wait);
|
|
424
|
+
return res;
|
|
425
|
+
} catch (err) {
|
|
426
|
+
if (!wait) Effects = null;
|
|
427
|
+
Updates = null;
|
|
428
|
+
handleError(err);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function completeUpdates(wait) {
|
|
432
|
+
if (Updates) {
|
|
433
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
434
|
+
else runQueue(Updates);
|
|
435
|
+
Updates = null;
|
|
436
|
+
}
|
|
437
|
+
if (wait) return;
|
|
438
|
+
let res;
|
|
439
|
+
if (Transition) {
|
|
440
|
+
if (!Transition.promises.size && !Transition.queue.size) {
|
|
441
|
+
const sources = Transition.sources;
|
|
442
|
+
const disposed = Transition.disposed;
|
|
443
|
+
Effects.push.apply(Effects, Transition.effects);
|
|
444
|
+
res = Transition.resolve;
|
|
445
|
+
for (const e2 of Effects) {
|
|
446
|
+
"tState" in e2 && (e2.state = e2.tState);
|
|
447
|
+
delete e2.tState;
|
|
448
|
+
}
|
|
449
|
+
Transition = null;
|
|
450
|
+
runUpdates(() => {
|
|
451
|
+
for (const d of disposed) cleanNode(d);
|
|
452
|
+
for (const v of sources) {
|
|
453
|
+
v.value = v.tValue;
|
|
454
|
+
if (v.owned) {
|
|
455
|
+
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
456
|
+
}
|
|
457
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
458
|
+
delete v.tValue;
|
|
459
|
+
delete v.tOwned;
|
|
460
|
+
v.tState = 0;
|
|
461
|
+
}
|
|
462
|
+
setTransPending(false);
|
|
463
|
+
});
|
|
464
|
+
} else if (Transition.running) {
|
|
465
|
+
Transition.running = false;
|
|
466
|
+
Transition.effects.push.apply(Transition.effects, Effects);
|
|
467
|
+
Effects = null;
|
|
468
|
+
setTransPending(true);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const e = Effects;
|
|
473
|
+
Effects = null;
|
|
474
|
+
if (e.length) runUpdates(() => runEffects(e));
|
|
475
|
+
if (res) res();
|
|
476
|
+
}
|
|
477
|
+
function runQueue(queue) {
|
|
478
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
479
|
+
}
|
|
480
|
+
function scheduleQueue(queue) {
|
|
481
|
+
for (let i = 0; i < queue.length; i++) {
|
|
482
|
+
const item = queue[i];
|
|
483
|
+
const tasks = Transition.queue;
|
|
484
|
+
if (!tasks.has(item)) {
|
|
485
|
+
tasks.add(item);
|
|
486
|
+
Scheduler(() => {
|
|
487
|
+
tasks.delete(item);
|
|
488
|
+
runUpdates(() => {
|
|
489
|
+
Transition.running = true;
|
|
490
|
+
runTop(item);
|
|
491
|
+
});
|
|
492
|
+
Transition && (Transition.running = false);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function runUserEffects(queue) {
|
|
498
|
+
let i, userLength = 0;
|
|
499
|
+
for (i = 0; i < queue.length; i++) {
|
|
500
|
+
const e = queue[i];
|
|
501
|
+
if (!e.user) runTop(e);
|
|
502
|
+
else queue[userLength++] = e;
|
|
503
|
+
}
|
|
504
|
+
if (sharedConfig.context) {
|
|
505
|
+
if (sharedConfig.count) {
|
|
506
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
507
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
508
|
+
return;
|
|
509
|
+
} else if (sharedConfig.effects) {
|
|
510
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
511
|
+
userLength += sharedConfig.effects.length;
|
|
512
|
+
delete sharedConfig.effects;
|
|
513
|
+
}
|
|
514
|
+
setHydrateContext();
|
|
515
|
+
}
|
|
516
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
517
|
+
}
|
|
518
|
+
function lookUpstream(node, ignore) {
|
|
519
|
+
const runningTransition = Transition && Transition.running;
|
|
520
|
+
if (runningTransition) node.tState = 0;
|
|
521
|
+
else node.state = 0;
|
|
522
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
523
|
+
const source = node.sources[i];
|
|
524
|
+
if (source.sources) {
|
|
525
|
+
const state = runningTransition ? source.tState : source.state;
|
|
526
|
+
if (state === STALE) {
|
|
527
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
528
|
+
runTop(source);
|
|
529
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function markDownstream(node) {
|
|
534
|
+
const runningTransition = Transition && Transition.running;
|
|
535
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
536
|
+
const o = node.observers[i];
|
|
537
|
+
if (runningTransition ? !o.tState : !o.state) {
|
|
538
|
+
if (runningTransition) o.tState = PENDING;
|
|
539
|
+
else o.state = PENDING;
|
|
540
|
+
if (o.pure) Updates.push(o);
|
|
541
|
+
else Effects.push(o);
|
|
542
|
+
o.observers && markDownstream(o);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function cleanNode(node) {
|
|
547
|
+
let i;
|
|
548
|
+
if (node.sources) {
|
|
549
|
+
while (node.sources.length) {
|
|
550
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
551
|
+
if (obs && obs.length) {
|
|
552
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
553
|
+
if (index < obs.length) {
|
|
554
|
+
n.sourceSlots[s] = index;
|
|
555
|
+
obs[index] = n;
|
|
556
|
+
source.observerSlots[index] = s;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (Transition && Transition.running && node.pure) {
|
|
562
|
+
if (node.tOwned) {
|
|
563
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
564
|
+
delete node.tOwned;
|
|
565
|
+
}
|
|
566
|
+
reset(node, true);
|
|
567
|
+
} else if (node.owned) {
|
|
568
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
569
|
+
node.owned = null;
|
|
570
|
+
}
|
|
571
|
+
if (node.cleanups) {
|
|
572
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
573
|
+
node.cleanups = null;
|
|
574
|
+
}
|
|
575
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
576
|
+
else node.state = 0;
|
|
577
|
+
}
|
|
578
|
+
function reset(node, top) {
|
|
579
|
+
if (!top) {
|
|
580
|
+
node.tState = 0;
|
|
581
|
+
Transition.disposed.add(node);
|
|
582
|
+
}
|
|
583
|
+
if (node.owned) {
|
|
584
|
+
for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function castError(err) {
|
|
588
|
+
if (err instanceof Error) return err;
|
|
589
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
590
|
+
cause: err
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
function runErrors(err, fns, owner) {
|
|
594
|
+
try {
|
|
595
|
+
for (const f of fns) f(err);
|
|
596
|
+
} catch (e) {
|
|
597
|
+
handleError(e, owner && owner.owner || null);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function handleError(err, owner = Owner) {
|
|
601
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
602
|
+
const error = castError(err);
|
|
603
|
+
if (!fns) throw error;
|
|
604
|
+
if (Effects)
|
|
605
|
+
Effects.push({
|
|
606
|
+
fn() {
|
|
607
|
+
runErrors(error, fns, owner);
|
|
608
|
+
},
|
|
609
|
+
state: STALE
|
|
610
|
+
});
|
|
611
|
+
else runErrors(error, fns, owner);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// node_modules/solid-js/web/dist/web.js
|
|
615
|
+
var booleans = [
|
|
616
|
+
"allowfullscreen",
|
|
617
|
+
"async",
|
|
618
|
+
"autofocus",
|
|
619
|
+
"autoplay",
|
|
620
|
+
"checked",
|
|
621
|
+
"controls",
|
|
622
|
+
"default",
|
|
623
|
+
"disabled",
|
|
624
|
+
"formnovalidate",
|
|
625
|
+
"hidden",
|
|
626
|
+
"indeterminate",
|
|
627
|
+
"inert",
|
|
628
|
+
"ismap",
|
|
629
|
+
"loop",
|
|
630
|
+
"multiple",
|
|
631
|
+
"muted",
|
|
632
|
+
"nomodule",
|
|
633
|
+
"novalidate",
|
|
634
|
+
"open",
|
|
635
|
+
"playsinline",
|
|
636
|
+
"readonly",
|
|
637
|
+
"required",
|
|
638
|
+
"reversed",
|
|
639
|
+
"seamless",
|
|
640
|
+
"selected"
|
|
641
|
+
];
|
|
642
|
+
/* @__PURE__ */ new Set([
|
|
643
|
+
"className",
|
|
644
|
+
"value",
|
|
645
|
+
"readOnly",
|
|
646
|
+
"formNoValidate",
|
|
647
|
+
"isMap",
|
|
648
|
+
"noModule",
|
|
649
|
+
"playsInline",
|
|
650
|
+
...booleans
|
|
651
|
+
]);
|
|
652
|
+
function template(html, isCE, isSVG) {
|
|
653
|
+
let node;
|
|
654
|
+
const create = () => {
|
|
655
|
+
const t = document.createElement("template");
|
|
656
|
+
t.innerHTML = html;
|
|
657
|
+
return t.content.firstChild;
|
|
658
|
+
};
|
|
659
|
+
const fn = () => (node || (node = create())).cloneNode(true);
|
|
660
|
+
fn.cloneNode = fn;
|
|
661
|
+
return fn;
|
|
662
|
+
}
|
|
663
|
+
function setAttribute(node, name, value) {
|
|
664
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
665
|
+
if (value == null) node.removeAttribute(name);
|
|
666
|
+
else node.setAttribute(name, value);
|
|
667
|
+
}
|
|
668
|
+
function use(fn, element, arg) {
|
|
669
|
+
return untrack(() => fn(element, arg));
|
|
670
|
+
}
|
|
671
|
+
|
|
100
672
|
// src/components/EditorPropTypes.ts
|
|
101
673
|
var PropTypes = __toESM(require_prop_types(), 1);
|
|
102
674
|
var eventPropTypes = {
|
|
@@ -419,6 +991,7 @@ var SolidEditor = (props) => {
|
|
|
419
991
|
const value = () => props.value || "";
|
|
420
992
|
const skin = () => props.skin || "oxide";
|
|
421
993
|
const contentCss = () => props.contentCss || "default";
|
|
994
|
+
const disabled = () => props.disabled || false;
|
|
422
995
|
const [editor, setEditor] = createSignal();
|
|
423
996
|
const [currentContent, setCurrentContent] = createSignal(value());
|
|
424
997
|
const [rollbackTimer, setRollbackTimer] = createSignal();
|
|
@@ -488,6 +1061,13 @@ var SolidEditor = (props) => {
|
|
|
488
1061
|
}
|
|
489
1062
|
}
|
|
490
1063
|
};
|
|
1064
|
+
const successHandler = () => {
|
|
1065
|
+
props.onScriptsLoad?.();
|
|
1066
|
+
initialise();
|
|
1067
|
+
};
|
|
1068
|
+
const errorHandler = (err) => {
|
|
1069
|
+
props.onScriptsLoadError?.(err);
|
|
1070
|
+
};
|
|
491
1071
|
const initialise = (attempts = 0) => {
|
|
492
1072
|
const target = props.elementRef;
|
|
493
1073
|
if (!target) {
|
|
@@ -546,8 +1126,8 @@ var SolidEditor = (props) => {
|
|
|
546
1126
|
editor2.setDirty(false);
|
|
547
1127
|
}
|
|
548
1128
|
setCurrentContent(newCurrentValue);
|
|
549
|
-
const
|
|
550
|
-
setMode(editor2,
|
|
1129
|
+
const isDisabled = disabled() ?? false;
|
|
1130
|
+
setMode(editor2, isDisabled ? "readonly" : "design");
|
|
551
1131
|
if (props.init && isFunction(props.init.init_instance_callback)) {
|
|
552
1132
|
props.init.init_instance_callback(editor2);
|
|
553
1133
|
}
|
|
@@ -565,14 +1145,8 @@ var SolidEditor = (props) => {
|
|
|
565
1145
|
if (getTinymce(view()) !== null) {
|
|
566
1146
|
initialise();
|
|
567
1147
|
} else if (Array.isArray(props.tinymceScriptSrc) && props.tinymceScriptSrc.length === 0) {
|
|
568
|
-
|
|
1148
|
+
props.onScriptsLoadError?.(new Error("No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array."));
|
|
569
1149
|
} else if (props?.elementRef?.ownerDocument) {
|
|
570
|
-
const successHandler = () => {
|
|
571
|
-
initialise();
|
|
572
|
-
};
|
|
573
|
-
const errorHandler = (err) => {
|
|
574
|
-
throw new Error(err);
|
|
575
|
-
};
|
|
576
1150
|
ScriptLoader.loadList(props.elementRef.ownerDocument, getScriptSources(), props.scriptLoading?.delay ?? 0, successHandler, errorHandler);
|
|
577
1151
|
}
|
|
578
1152
|
};
|
|
@@ -604,9 +1178,14 @@ var SolidEditor = (props) => {
|
|
|
604
1178
|
}));
|
|
605
1179
|
createEffect(on(skin, () => {
|
|
606
1180
|
cleanUpCallback();
|
|
607
|
-
setTimeout(
|
|
608
|
-
|
|
609
|
-
|
|
1181
|
+
setTimeout(mountCallback, 1);
|
|
1182
|
+
}));
|
|
1183
|
+
createEffect(on(disabled, () => {
|
|
1184
|
+
const tinyEditor = editor();
|
|
1185
|
+
if (tinyEditor?.initialized) {
|
|
1186
|
+
const isDisabled = disabled() ?? false;
|
|
1187
|
+
setMode(tinyEditor, isDisabled ? "readonly" : "design");
|
|
1188
|
+
}
|
|
610
1189
|
}));
|
|
611
1190
|
onMount(mountCallback);
|
|
612
1191
|
onCleanup(cleanUpCallback);
|
|
@@ -675,36 +1254,34 @@ var SolidEditor = (props) => {
|
|
|
675
1254
|
var _el$ = _tmpl$();
|
|
676
1255
|
var _ref$ = props.elementRef;
|
|
677
1256
|
typeof _ref$ === "function" ? use(_ref$, _el$) : props.elementRef = _el$;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
_v$
|
|
681
|
-
_v$
|
|
682
|
-
_v$
|
|
683
|
-
_v$
|
|
1257
|
+
_el$.style.setProperty("visibility", "hidden");
|
|
1258
|
+
createRenderEffect((_p$) => {
|
|
1259
|
+
var _v$ = id(), _v$2 = props.testid, _v$3 = props.tabIndex;
|
|
1260
|
+
_v$ !== _p$.e && setAttribute(_el$, "id", _p$.e = _v$);
|
|
1261
|
+
_v$2 !== _p$.t && setAttribute(_el$, "data-testid", _p$.t = _v$2);
|
|
1262
|
+
_v$3 !== _p$.a && setAttribute(_el$, "tabindex", _p$.a = _v$3);
|
|
684
1263
|
return _p$;
|
|
685
1264
|
}, {
|
|
686
1265
|
e: void 0,
|
|
687
1266
|
t: void 0,
|
|
688
|
-
a: void 0
|
|
689
|
-
o: void 0
|
|
1267
|
+
a: void 0
|
|
690
1268
|
});
|
|
691
1269
|
return _el$;
|
|
692
1270
|
})() : (() => {
|
|
693
1271
|
var _el$2 = _tmpl$2();
|
|
694
1272
|
var _ref$2 = props.elementRef;
|
|
695
1273
|
typeof _ref$2 === "function" ? use(_ref$2, _el$2) : props.elementRef = _el$2;
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
_v$
|
|
699
|
-
_v$
|
|
700
|
-
_v$
|
|
701
|
-
_v$
|
|
1274
|
+
_el$2.style.setProperty("visibility", "hidden");
|
|
1275
|
+
createRenderEffect((_p$) => {
|
|
1276
|
+
var _v$4 = id(), _v$5 = props.testid, _v$6 = props.tabIndex;
|
|
1277
|
+
_v$4 !== _p$.e && setAttribute(_el$2, "id", _p$.e = _v$4);
|
|
1278
|
+
_v$5 !== _p$.t && setAttribute(_el$2, "data-testid", _p$.t = _v$5);
|
|
1279
|
+
_v$6 !== _p$.a && setAttribute(_el$2, "tabindex", _p$.a = _v$6);
|
|
702
1280
|
return _p$;
|
|
703
1281
|
}, {
|
|
704
1282
|
e: void 0,
|
|
705
1283
|
t: void 0,
|
|
706
|
-
a: void 0
|
|
707
|
-
o: void 0
|
|
1284
|
+
a: void 0
|
|
708
1285
|
});
|
|
709
1286
|
return _el$2;
|
|
710
1287
|
})();
|