@textbus/xnote 0.0.11 → 0.1.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.
- package/bundles/components/_api.d.ts +1 -0
- package/bundles/components/color-picker/color-picker.d.ts +28 -0
- package/bundles/index.css +1 -1
- package/bundles/index.esm.css +1 -1
- package/bundles/index.esm.js +571 -181
- package/bundles/index.js +572 -178
- package/bundles/textbus/attributes/_api.d.ts +1 -0
- package/bundles/textbus/attributes/cell-background.attr.d.ts +4 -0
- package/package.json +2 -2
package/bundles/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('@viewfly/core/jsx-runtime');
|
|
|
4
4
|
var scopedCss = require('@viewfly/scoped-css');
|
|
5
5
|
var core = require('@viewfly/core');
|
|
6
6
|
var core$1 = require('@textbus/core');
|
|
7
|
+
var color = require('@tanbo/color');
|
|
7
8
|
var platformBrowser = require('@textbus/platform-browser');
|
|
8
9
|
var platformBrowser$1 = require('@viewfly/platform-browser');
|
|
9
10
|
var hooks = require('@viewfly/hooks');
|
|
@@ -11,10 +12,9 @@ var highlightjs = require('highlight.js');
|
|
|
11
12
|
var uuid = require('uuid');
|
|
12
13
|
var Katex = require('katex');
|
|
13
14
|
var adapterViewfly = require('@textbus/adapter-viewfly');
|
|
14
|
-
var color = require('@tanbo/color');
|
|
15
15
|
var collaborate = require('@textbus/collaborate');
|
|
16
16
|
|
|
17
|
-
var scopedId$
|
|
17
|
+
var scopedId$o = "vf-d94b56";
|
|
18
18
|
|
|
19
19
|
/******************************************************************************
|
|
20
20
|
Copyright (c) Microsoft Corporation.
|
|
@@ -147,7 +147,7 @@ function Button(props) {
|
|
|
147
147
|
subscription.unsubscribe();
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
return scopedCss.withScopedCSS(scopedId$
|
|
150
|
+
return scopedCss.withScopedCSS(scopedId$o, () => {
|
|
151
151
|
return (jsxRuntime.jsxs("button", Object.assign({ type: "button" }, props, { class: [
|
|
152
152
|
'btn',
|
|
153
153
|
{
|
|
@@ -159,6 +159,346 @@ function Button(props) {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
var scopedId$n = "vf-d552b9";
|
|
163
|
+
|
|
164
|
+
class Picker {
|
|
165
|
+
set hex(color$1) {
|
|
166
|
+
var _a;
|
|
167
|
+
const c = color$1 ? color.normalizeHex(color$1) : null;
|
|
168
|
+
if (c) {
|
|
169
|
+
this.empty = false;
|
|
170
|
+
this._hex = c;
|
|
171
|
+
this._hsl = color.hex2Hsl(c);
|
|
172
|
+
this._rgb = color.hex2Rgb(c);
|
|
173
|
+
this._hsv = color.hex2Hsv(c);
|
|
174
|
+
this._rgba = Object.assign(Object.assign({}, this._rgb), { a: this.resetAlpha ? 1 : ((_a = this._rgba) === null || _a === void 0 ? void 0 : _a.a) || 1 });
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.empty = true;
|
|
178
|
+
}
|
|
179
|
+
this.resetAlpha = true;
|
|
180
|
+
this.onChange();
|
|
181
|
+
}
|
|
182
|
+
get hex() {
|
|
183
|
+
return this.empty ? null : this._hex;
|
|
184
|
+
}
|
|
185
|
+
set hsl(color$1) {
|
|
186
|
+
var _a;
|
|
187
|
+
if (!color$1 || typeof color$1.h !== 'number' || typeof color$1.s !== 'number' || typeof color$1.l !== 'number') {
|
|
188
|
+
this.empty = true;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.empty = false;
|
|
192
|
+
this._hsl = color$1;
|
|
193
|
+
this._hex = color.hsl2Hex(color$1);
|
|
194
|
+
this._hsv = color.hsl2Hsv(color$1);
|
|
195
|
+
this._rgb = color.hsl2Rgb(color$1);
|
|
196
|
+
this._rgba = Object.assign(Object.assign({}, this._rgb), { a: this.resetAlpha ? 1 : ((_a = this._rgba) === null || _a === void 0 ? void 0 : _a.a) || 1 });
|
|
197
|
+
}
|
|
198
|
+
this.resetAlpha = true;
|
|
199
|
+
this.onChange();
|
|
200
|
+
}
|
|
201
|
+
get hsl() {
|
|
202
|
+
return this.empty ? null : this._hsl;
|
|
203
|
+
}
|
|
204
|
+
set rgb(color$1) {
|
|
205
|
+
var _a;
|
|
206
|
+
if (!color$1 || typeof color$1.r !== 'number' || typeof color$1.g !== 'number' || typeof color$1.b !== 'number') {
|
|
207
|
+
this.empty = true;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
this.empty = false;
|
|
211
|
+
this._rgb = color$1;
|
|
212
|
+
this._rgba = Object.assign(Object.assign({}, color$1), { a: this.resetAlpha ? 1 : ((_a = this._rgba) === null || _a === void 0 ? void 0 : _a.a) || 1 });
|
|
213
|
+
this._hsl = color.rgb2Hsl(color$1);
|
|
214
|
+
this._hex = color.rgb2Hex(color$1);
|
|
215
|
+
this._hsv = color.rgb2Hsv(color$1);
|
|
216
|
+
}
|
|
217
|
+
this.resetAlpha = true;
|
|
218
|
+
this.onChange();
|
|
219
|
+
}
|
|
220
|
+
get rgb() {
|
|
221
|
+
return this.empty ? null : this._rgb;
|
|
222
|
+
}
|
|
223
|
+
set rgba(color$1) {
|
|
224
|
+
if (!color$1 ||
|
|
225
|
+
typeof color$1.r !== 'number' ||
|
|
226
|
+
typeof color$1.g !== 'number' ||
|
|
227
|
+
typeof color$1.b !== 'number' ||
|
|
228
|
+
typeof color$1.a !== 'number') {
|
|
229
|
+
this.empty = true;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.empty = false;
|
|
233
|
+
this._rgba = color$1;
|
|
234
|
+
this._hsl = color.rgb2Hsl(color$1);
|
|
235
|
+
this._hex = color.rgb2Hex(color$1);
|
|
236
|
+
this._hsv = color.rgb2Hsv(color$1);
|
|
237
|
+
}
|
|
238
|
+
this.onChange();
|
|
239
|
+
}
|
|
240
|
+
get rgba() {
|
|
241
|
+
return this.empty ? null : this._rgba;
|
|
242
|
+
}
|
|
243
|
+
set hsv(color$1) {
|
|
244
|
+
var _a;
|
|
245
|
+
if (!color$1 || typeof color$1.h !== 'number' || typeof color$1.s !== 'number' || typeof color$1.v !== 'number') {
|
|
246
|
+
this.empty = true;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.empty = false;
|
|
250
|
+
this._hsv = color$1;
|
|
251
|
+
this._hex = color.hsv2Hex(color$1);
|
|
252
|
+
this._hsl = color.hsv2Hsl(color$1);
|
|
253
|
+
this._rgb = color.hsv2Rgb(color$1);
|
|
254
|
+
this._rgba = Object.assign(Object.assign({}, this._rgb), { a: this.resetAlpha ? 1 : ((_a = this._rgba) === null || _a === void 0 ? void 0 : _a.a) || 1 });
|
|
255
|
+
}
|
|
256
|
+
this.resetAlpha = true;
|
|
257
|
+
this.onChange();
|
|
258
|
+
}
|
|
259
|
+
get hsv() {
|
|
260
|
+
return this.empty ? null : this._hsv;
|
|
261
|
+
}
|
|
262
|
+
constructor(onChange, value) {
|
|
263
|
+
this.onChange = onChange;
|
|
264
|
+
this._hex = '';
|
|
265
|
+
this._hsl = null;
|
|
266
|
+
this._rgb = null;
|
|
267
|
+
this._hsv = null;
|
|
268
|
+
this._rgba = null;
|
|
269
|
+
this.empty = false;
|
|
270
|
+
this.resetAlpha = true;
|
|
271
|
+
this.hex = value || '#f00';
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const recentColors = core.createSignal([]);
|
|
275
|
+
function ColorPicker(props) {
|
|
276
|
+
const instance = core.getCurrentInstance();
|
|
277
|
+
const picker = new Picker(() => {
|
|
278
|
+
instance.markAsDirtied();
|
|
279
|
+
}, props.value);
|
|
280
|
+
const mainColors = [
|
|
281
|
+
'#000', '#333', '#444', '#555', '#666', '#777', '#888',
|
|
282
|
+
'#999', '#aaa', '#bbb', '#ccc', '#ddd', '#eee', '#fff',
|
|
283
|
+
];
|
|
284
|
+
const colors = [
|
|
285
|
+
'#fec6c2', '#fee5c3', '#fefcc3', '#baf6c4', '#c3ebfe', '#c3cbfe', '#e1caff',
|
|
286
|
+
'#fc8e88', '#fccc88', '#fcf888', '#76ec8a', '#88d8fc', '#97a4fb', '#c098f4',
|
|
287
|
+
'#ff6666', '#ffb151', '#fada3a', '#18c937', '#3aaafa', '#6373e2', '#a669f7',
|
|
288
|
+
'#f63030', '#f88933', '#deb12a', '#038e23', '#1276cc', '#3f52ce', '#8838ed',
|
|
289
|
+
'#c60000', '#d86912', '#b88811', '#086508', '#144c93', '#1b2eaa', '#6117bf',
|
|
290
|
+
];
|
|
291
|
+
function addRecentColor() {
|
|
292
|
+
const color = picker.hex;
|
|
293
|
+
if (!color) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const colors = recentColors().filter(item => {
|
|
297
|
+
return item !== color;
|
|
298
|
+
});
|
|
299
|
+
colors.unshift(color);
|
|
300
|
+
if (colors.length >= 7) {
|
|
301
|
+
colors.length = 7;
|
|
302
|
+
}
|
|
303
|
+
recentColors.set(colors);
|
|
304
|
+
}
|
|
305
|
+
const paletteRef = core.createRef();
|
|
306
|
+
function bindPaletteEvent(ev) {
|
|
307
|
+
const update = (ev) => {
|
|
308
|
+
var _a;
|
|
309
|
+
const position = paletteRef.current.getBoundingClientRect();
|
|
310
|
+
const offsetX = ev.clientX - position.left;
|
|
311
|
+
const offsetY = ev.clientY - position.top;
|
|
312
|
+
let s = offsetX / 130 * 100;
|
|
313
|
+
let v = 100 - offsetY / 130 * 100;
|
|
314
|
+
s = Math.max(0, s);
|
|
315
|
+
s = Math.min(100, s);
|
|
316
|
+
v = Math.max(0, v);
|
|
317
|
+
v = Math.min(100, v);
|
|
318
|
+
picker.resetAlpha = false;
|
|
319
|
+
picker.hsv = {
|
|
320
|
+
h: picker.hsv.h,
|
|
321
|
+
s,
|
|
322
|
+
v
|
|
323
|
+
};
|
|
324
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
325
|
+
};
|
|
326
|
+
update(ev);
|
|
327
|
+
const unMouseMove = core$1.fromEvent(document, 'mousemove').subscribe(ev => {
|
|
328
|
+
update(ev);
|
|
329
|
+
});
|
|
330
|
+
const unMouseUp = core$1.fromEvent(document, 'mouseup').subscribe(() => {
|
|
331
|
+
unMouseMove.unsubscribe();
|
|
332
|
+
unMouseUp.unsubscribe();
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
const hueBarRef = core.createRef();
|
|
336
|
+
function bindHueBarEvent(ev) {
|
|
337
|
+
const update = (ev) => {
|
|
338
|
+
var _a;
|
|
339
|
+
const position = hueBarRef.current.getBoundingClientRect();
|
|
340
|
+
let offsetY = ev.clientY - position.top;
|
|
341
|
+
offsetY = Math.max(0, offsetY);
|
|
342
|
+
offsetY = Math.min(100, offsetY);
|
|
343
|
+
const h = 360 / 100 * offsetY;
|
|
344
|
+
picker.resetAlpha = false;
|
|
345
|
+
picker.hsv = {
|
|
346
|
+
h,
|
|
347
|
+
s: picker.hsv.s,
|
|
348
|
+
v: picker.hsv.v
|
|
349
|
+
};
|
|
350
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
351
|
+
};
|
|
352
|
+
update(ev);
|
|
353
|
+
const unMouseMove = core$1.fromEvent(document, 'mousemove').subscribe(ev => {
|
|
354
|
+
update(ev);
|
|
355
|
+
});
|
|
356
|
+
const unMouseUp = core$1.fromEvent(document, 'mouseup').subscribe(() => {
|
|
357
|
+
unMouseMove.unsubscribe();
|
|
358
|
+
unMouseUp.unsubscribe();
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
const alphaBarRef = core.createRef();
|
|
362
|
+
function bindAlphaEvent(ev) {
|
|
363
|
+
const update = (ev) => {
|
|
364
|
+
var _a;
|
|
365
|
+
const position = alphaBarRef.current.getBoundingClientRect();
|
|
366
|
+
let offsetX = ev.clientX - position.left;
|
|
367
|
+
offsetX = Math.max(0, offsetX);
|
|
368
|
+
offsetX = Math.min(position.width, offsetX);
|
|
369
|
+
picker.rgba = Object.assign(Object.assign({}, picker.rgba), { a: offsetX / position.width });
|
|
370
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
371
|
+
};
|
|
372
|
+
update(ev);
|
|
373
|
+
const unMouseMove = core$1.fromEvent(document, 'mousemove').subscribe(ev => {
|
|
374
|
+
update(ev);
|
|
375
|
+
});
|
|
376
|
+
const unMouseUp = core$1.fromEvent(document, 'mouseup').subscribe(() => {
|
|
377
|
+
unMouseMove.unsubscribe();
|
|
378
|
+
unMouseUp.unsubscribe();
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function bindInputsEvent(ev) {
|
|
382
|
+
var _a;
|
|
383
|
+
const updateByHSL = (h, s, l) => {
|
|
384
|
+
var _a;
|
|
385
|
+
picker.hex = color.hsl2Hex({ h, s, l });
|
|
386
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
387
|
+
};
|
|
388
|
+
const updateByRGB = (r, g, b) => {
|
|
389
|
+
var _a;
|
|
390
|
+
picker.hex = color.rgb2Hex({ r, g, b });
|
|
391
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
392
|
+
};
|
|
393
|
+
const el = ev.target;
|
|
394
|
+
const model = el.getAttribute('data-model');
|
|
395
|
+
if (el.type === 'number') {
|
|
396
|
+
const min = +el.min;
|
|
397
|
+
const max = +el.max;
|
|
398
|
+
el.value = Math.max(+el.value, min) + '';
|
|
399
|
+
el.value = Math.min(+el.value, max) + '';
|
|
400
|
+
}
|
|
401
|
+
const { h, s, l } = picker.hsl;
|
|
402
|
+
const { r, g, b } = picker.rgb;
|
|
403
|
+
switch (model) {
|
|
404
|
+
case 'H':
|
|
405
|
+
updateByHSL(+el.value, s, l);
|
|
406
|
+
break;
|
|
407
|
+
case 'S':
|
|
408
|
+
updateByHSL(h, +el.value, l);
|
|
409
|
+
break;
|
|
410
|
+
case 'L':
|
|
411
|
+
updateByHSL(h, s, +el.value);
|
|
412
|
+
break;
|
|
413
|
+
case 'R':
|
|
414
|
+
updateByRGB(+el.value, g, b);
|
|
415
|
+
break;
|
|
416
|
+
case 'G':
|
|
417
|
+
updateByRGB(r, +el.value, b);
|
|
418
|
+
break;
|
|
419
|
+
case 'B':
|
|
420
|
+
updateByRGB(r, g, +el.value);
|
|
421
|
+
break;
|
|
422
|
+
case 'HEX':
|
|
423
|
+
if (/^#(([0-9a-f]){3}){1,2}$/i.test(el.value)) {
|
|
424
|
+
picker.hex = el.value;
|
|
425
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, picker);
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const isShowPalette = core.createSignal(false);
|
|
431
|
+
function selected() {
|
|
432
|
+
props.onSelected(picker);
|
|
433
|
+
addRecentColor();
|
|
434
|
+
isShowPalette.set(false);
|
|
435
|
+
}
|
|
436
|
+
function bindColorOptionsEvent(ev) {
|
|
437
|
+
const target = ev.target;
|
|
438
|
+
if (!target.hasAttribute('data-color')) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const c = target.getAttribute('data-color');
|
|
442
|
+
if (/^rgba/.test(c)) {
|
|
443
|
+
picker.rgba = color.parseCss(c);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
picker.hex = c;
|
|
447
|
+
}
|
|
448
|
+
props.onSelected(picker);
|
|
449
|
+
addRecentColor();
|
|
450
|
+
}
|
|
451
|
+
return scopedCss.withScopedCSS(scopedId$n, () => {
|
|
452
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
453
|
+
return (jsxRuntime.jsxs("div", { onMousedown: ev => {
|
|
454
|
+
ev.stopPropagation();
|
|
455
|
+
}, class: {
|
|
456
|
+
'xnote-color-picker': true,
|
|
457
|
+
'xnote-color-picker-show-palette': isShowPalette()
|
|
458
|
+
}, children: [jsxRuntime.jsxs("div", { class: "xnote-color-picker-preset", onClick: bindColorOptionsEvent, children: [jsxRuntime.jsx("div", { class: "xnote-color-picker-swatches", style: "height: 50px", children: mainColors.map(color$1 => {
|
|
459
|
+
var _a, _b, _c;
|
|
460
|
+
const hsl = (color.any2Hsl(color$1) || {});
|
|
461
|
+
return (jsxRuntime.jsx("div", { "data-color": color$1, class: {
|
|
462
|
+
'xnote-color-picker-current': hsl.l === ((_a = picker.hsl) === null || _a === void 0 ? void 0 : _a.l) && hsl.s === ((_b = picker.hsl) === null || _b === void 0 ? void 0 : _b.s) && hsl.h === ((_c = picker.hsl) === null || _c === void 0 ? void 0 : _c.h),
|
|
463
|
+
}, style: {
|
|
464
|
+
background: color$1
|
|
465
|
+
} }));
|
|
466
|
+
}) }), jsxRuntime.jsx("div", { class: "xnote-color-picker-swatches", style: "height: 118px;", children: colors.map(color => {
|
|
467
|
+
return (jsxRuntime.jsx("div", { "data-color": color, style: {
|
|
468
|
+
background: color
|
|
469
|
+
} }));
|
|
470
|
+
}) }), jsxRuntime.jsx("div", { class: "xnote-color-picker-recent-text", children: "\u6700\u8FD1\u989C\u8272" }), jsxRuntime.jsx("div", { class: "xnote-color-picker-swatches", style: "height: 25px;", children: Array.from({ length: 7 }).map((_, index) => {
|
|
471
|
+
const colors = recentColors();
|
|
472
|
+
const color = colors[index] || '';
|
|
473
|
+
return (jsxRuntime.jsx("div", { "data-color": color || 'unknown', style: {
|
|
474
|
+
background: color
|
|
475
|
+
} }));
|
|
476
|
+
}) }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-flex", children: [jsxRuntime.jsx("div", { class: "xnote-color-picker-swatches", children: jsxRuntime.jsx("div", { "data-color": "" }) }), jsxRuntime.jsxs("button", { type: "button", class: "xnote-color-picker-to-palette", onClick: () => {
|
|
477
|
+
isShowPalette.set(true);
|
|
478
|
+
}, children: ["\u8C03\u8272\u76D8", jsxRuntime.jsx("svg", { style: "vertical-align: middle;fill: currentColor;overflow: hidden;", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { transform: "rotate(180, 512, 512)", d: "M497.92 165.12L422.4 89.6 0 512l422.4 422.4 75.52-75.52L151.04 512z" }) })] })] })] }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-menu", children: [jsxRuntime.jsx("div", { class: "xnote-color-picker-back-btn-wrap", children: jsxRuntime.jsxs("button", { type: "button", class: "xnote-color-picker-back-btn", onClick: () => {
|
|
479
|
+
isShowPalette.set(false);
|
|
480
|
+
}, children: [jsxRuntime.jsx("svg", { style: "vertical-align: middle;fill: currentColor;overflow: hidden;", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M497.92 165.12L422.4 89.6 0 512l422.4 422.4 75.52-75.52L151.04 512z" }) }), "\u8FD4\u56DE"] }) }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-viewer", children: [jsxRuntime.jsxs("div", { class: "xnote-color-picker-viewer-left", children: [jsxRuntime.jsx("div", { class: [
|
|
481
|
+
'xnote-color-picker-palette',
|
|
482
|
+
{
|
|
483
|
+
'xnote-color-picker-palette-empty': picker.empty
|
|
484
|
+
}
|
|
485
|
+
], style: {
|
|
486
|
+
background: picker.empty ? '' : `linear-gradient(to right, #fff, hsl(${(_a = picker.hsv) === null || _a === void 0 ? void 0 : _a.h}, 100%, 50%))`
|
|
487
|
+
}, ref: paletteRef, onMousedown: bindPaletteEvent, children: jsxRuntime.jsx("div", { class: "xnote-color-picker-palette-point", style: {
|
|
488
|
+
left: `calc(${(_b = picker.hsv) === null || _b === void 0 ? void 0 : _b.s}% - 6px)`,
|
|
489
|
+
top: `calc(${100 - (((_c = picker.hsv) === null || _c === void 0 ? void 0 : _c.v) || 0)}% - 6px)`
|
|
490
|
+
} }) }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-viewer-alpha", children: [jsxRuntime.jsx("div", { class: "xnote-color-picker-viewer-alpha-pointer", style: {
|
|
491
|
+
left: picker.empty ? '100%' : (((_d = picker.rgba) === null || _d === void 0 ? void 0 : _d.a) || 0) * 100 + '%',
|
|
492
|
+
} }), jsxRuntime.jsx("div", { class: "xnote-color-picker-viewer-alpha-bar", style: {
|
|
493
|
+
background: picker.empty ? '' : `linear-gradient(to right, transparent, ${picker.hex})`
|
|
494
|
+
}, onMousedown: bindAlphaEvent, ref: alphaBarRef })] })] }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-viewer-right", children: [jsxRuntime.jsxs("div", { class: "xnote-color-picker-tools", children: [jsxRuntime.jsx("div", { class: "xnote-color-picker-value", children: jsxRuntime.jsx("div", { class: "xnote-color-picker-value-color", style: {
|
|
495
|
+
background: picker.empty ? '' : `rgba(${(_e = picker.rgba) === null || _e === void 0 ? void 0 : _e.r}, ${(_f = picker.rgba) === null || _f === void 0 ? void 0 : _f.g}, ${(_g = picker.rgba) === null || _g === void 0 ? void 0 : _g.b}, ${(_h = picker.rgba) === null || _h === void 0 ? void 0 : _h.a})`
|
|
496
|
+
} }) }), jsxRuntime.jsx("div", { class: "xnote-color-picker-hue-bar", ref: hueBarRef, onMousedown: bindHueBarEvent, children: jsxRuntime.jsx("div", { class: "xnote-color-picker-hue-pointer", style: {
|
|
497
|
+
top: `calc(${(((_j = picker.hsv) === null || _j === void 0 ? void 0 : _j.h) || 0) / 360 * 100}% - 4px)`
|
|
498
|
+
} }) })] }), jsxRuntime.jsx("div", { class: "xnote-color-picker-viewer-alpha-value", children: Number((_k = picker.rgba) === null || _k === void 0 ? void 0 : _k.a.toFixed(2)) })] })] }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-inputs", onInput: bindInputsEvent, children: [jsxRuntime.jsxs("div", { class: "xnote-color-picker-hsl", children: [jsxRuntime.jsxs("div", { children: ["H ", jsxRuntime.jsx("input", { "data-model": "H", min: "0", max: "360", type: "number", value: (_l = picker.hsl) === null || _l === void 0 ? void 0 : _l.h })] }), jsxRuntime.jsxs("div", { children: ["S ", jsxRuntime.jsx("input", { "data-model": "S", min: "0", max: "100", type: "number", value: (_m = picker.hsl) === null || _m === void 0 ? void 0 : _m.s })] }), jsxRuntime.jsxs("div", { children: ["L ", jsxRuntime.jsx("input", { "data-model": "L", min: "0", max: "100", type: "number", value: (_o = picker.hsl) === null || _o === void 0 ? void 0 : _o.l })] })] }), jsxRuntime.jsxs("div", { class: "xnote-color-picker-rgb", children: [jsxRuntime.jsxs("div", { children: ["R ", jsxRuntime.jsx("input", { "data-model": "R", min: "0", max: "255", type: "number", value: (_p = picker.rgb) === null || _p === void 0 ? void 0 : _p.r })] }), jsxRuntime.jsxs("div", { children: ["G ", jsxRuntime.jsx("input", { "data-model": "G", min: "0", max: "255", type: "number", value: (_q = picker.rgb) === null || _q === void 0 ? void 0 : _q.g })] }), jsxRuntime.jsxs("div", { children: ["B ", jsxRuntime.jsx("input", { "data-model": "B", min: "0", max: "255", type: "number", value: (_r = picker.rgb) === null || _r === void 0 ? void 0 : _r.b })] })] }), jsxRuntime.jsx("div", { class: "xnote-color-picker-hex", children: jsxRuntime.jsxs("div", { children: ["HEX ", jsxRuntime.jsx("input", { "data-model": "HEX", type: "text", value: picker.hex })] }) })] }), jsxRuntime.jsx("div", { class: "xnote-color-picker-btn-wrap", children: jsxRuntime.jsx("button", { type: "button", class: "xnote-color-picker-btn", onClick: selected, children: "\u786E\u5B9A" }) })] })] }));
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
|
|
162
502
|
var scopedId$m = "vf-ac7e8d";
|
|
163
503
|
|
|
164
504
|
function ComponentToolbar(props) {
|
|
@@ -939,6 +1279,166 @@ const highlightBoxComponentLoader = {
|
|
|
939
1279
|
}
|
|
940
1280
|
};
|
|
941
1281
|
|
|
1282
|
+
const fontSizeFormatter = new core$1.Formatter('fontSize', {
|
|
1283
|
+
render(children, formatValue) {
|
|
1284
|
+
return {
|
|
1285
|
+
fallbackTagName: 'span',
|
|
1286
|
+
attach(host) {
|
|
1287
|
+
host.styles.set('fontSize', formatValue);
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
const fontSizeFormatLoader = {
|
|
1293
|
+
match(element) {
|
|
1294
|
+
return !!element.style.fontSize;
|
|
1295
|
+
},
|
|
1296
|
+
read(element) {
|
|
1297
|
+
return {
|
|
1298
|
+
formatter: fontSizeFormatter,
|
|
1299
|
+
value: element.style.fontSize
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
const boldFormatter = new core$1.Formatter('bold', {
|
|
1305
|
+
render(children) {
|
|
1306
|
+
return core$1.createVNode('strong', null, children);
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
function toggleBold(textbus) {
|
|
1310
|
+
const controller = textbus.get(core$1.Controller);
|
|
1311
|
+
if (controller.readonly) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
const query = textbus.get(core$1.Query);
|
|
1315
|
+
const commander = textbus.get(core$1.Commander);
|
|
1316
|
+
const state = query.queryFormat(boldFormatter);
|
|
1317
|
+
if (state.state === core$1.QueryStateType.Normal) {
|
|
1318
|
+
commander.applyFormat(boldFormatter, true);
|
|
1319
|
+
}
|
|
1320
|
+
else {
|
|
1321
|
+
commander.unApplyFormat(boldFormatter);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
function registerBoldShortcut(textbus) {
|
|
1325
|
+
const keyboard = textbus.get(core$1.Keyboard);
|
|
1326
|
+
keyboard.addShortcut({
|
|
1327
|
+
keymap: {
|
|
1328
|
+
modKey: true,
|
|
1329
|
+
key: 'b'
|
|
1330
|
+
},
|
|
1331
|
+
action: () => {
|
|
1332
|
+
toggleBold(textbus);
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
const boldFormatLoader = {
|
|
1337
|
+
match(element) {
|
|
1338
|
+
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
1339
|
+
},
|
|
1340
|
+
read() {
|
|
1341
|
+
return {
|
|
1342
|
+
formatter: boldFormatter,
|
|
1343
|
+
value: true
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
const colorFormatter = new core$1.Formatter('color', {
|
|
1349
|
+
render(children, formatValue) {
|
|
1350
|
+
return {
|
|
1351
|
+
fallbackTagName: 'span',
|
|
1352
|
+
attach(host) {
|
|
1353
|
+
host.styles.set('color', formatValue);
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
const colorFormatLoader = {
|
|
1359
|
+
match(element) {
|
|
1360
|
+
return !!element.style.color;
|
|
1361
|
+
},
|
|
1362
|
+
read(element) {
|
|
1363
|
+
return {
|
|
1364
|
+
formatter: colorFormatter,
|
|
1365
|
+
value: element.style.color
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
function createTimelineItem(textbus, theme) {
|
|
1371
|
+
const slot = new core$1.Slot([
|
|
1372
|
+
core$1.ContentType.BlockComponent,
|
|
1373
|
+
]);
|
|
1374
|
+
const title = new ParagraphComponent(textbus);
|
|
1375
|
+
title.state.slot.insert('时间主题', [
|
|
1376
|
+
[fontSizeFormatter, '18px'],
|
|
1377
|
+
[boldFormatter, true]
|
|
1378
|
+
]);
|
|
1379
|
+
title.state.slot.insert(' 2020-02-02', [
|
|
1380
|
+
[fontSizeFormatter, '15px'],
|
|
1381
|
+
[colorFormatter, '#777']
|
|
1382
|
+
]);
|
|
1383
|
+
const desc = new ParagraphComponent(textbus);
|
|
1384
|
+
desc.state.slot.insert('描述信息...');
|
|
1385
|
+
slot.insert(title);
|
|
1386
|
+
slot.insert(desc);
|
|
1387
|
+
return { theme, slot };
|
|
1388
|
+
}
|
|
1389
|
+
class TimelineComponent extends core$1.Component {
|
|
1390
|
+
static fromJSON(textbus, json) {
|
|
1391
|
+
const registry = textbus.get(core$1.Registry);
|
|
1392
|
+
return new TimelineComponent(textbus, {
|
|
1393
|
+
items: json.items.map(i => {
|
|
1394
|
+
return {
|
|
1395
|
+
theme: i.theme,
|
|
1396
|
+
slot: registry.createSlot(i.slot)
|
|
1397
|
+
};
|
|
1398
|
+
})
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
getSlots() {
|
|
1402
|
+
return this.state.items.map(i => i.slot);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
TimelineComponent.componentName = 'TimelineComponent';
|
|
1406
|
+
TimelineComponent.type = core$1.ContentType.BlockComponent;
|
|
1407
|
+
|
|
1408
|
+
function createStepItem(textbus) {
|
|
1409
|
+
const slot = new core$1.Slot([
|
|
1410
|
+
core$1.ContentType.BlockComponent
|
|
1411
|
+
]);
|
|
1412
|
+
const title = new ParagraphComponent(textbus);
|
|
1413
|
+
title.state.slot.insert('标题', [
|
|
1414
|
+
[fontSizeFormatter, '18px'],
|
|
1415
|
+
[boldFormatter, true]
|
|
1416
|
+
]);
|
|
1417
|
+
const content = new ParagraphComponent(textbus);
|
|
1418
|
+
content.state.slot.insert('描述信息...');
|
|
1419
|
+
slot.insert(title);
|
|
1420
|
+
slot.insert(content);
|
|
1421
|
+
return { slot };
|
|
1422
|
+
}
|
|
1423
|
+
class StepComponent extends core$1.Component {
|
|
1424
|
+
static fromJSON(textbus, json) {
|
|
1425
|
+
const registry = textbus.get(core$1.Registry);
|
|
1426
|
+
return new StepComponent(textbus, {
|
|
1427
|
+
step: json.step,
|
|
1428
|
+
items: json.items.map(i => {
|
|
1429
|
+
return {
|
|
1430
|
+
slot: registry.createSlot(i.slot)
|
|
1431
|
+
};
|
|
1432
|
+
})
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
getSlots() {
|
|
1436
|
+
return this.state.items.map(i => i.slot);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
StepComponent.componentName = 'StepComponent';
|
|
1440
|
+
StepComponent.type = core$1.ContentType.BlockComponent;
|
|
1441
|
+
|
|
942
1442
|
class ParagraphComponent extends core$1.Component {
|
|
943
1443
|
static fromJSON(textbus, json) {
|
|
944
1444
|
const slot = textbus.get(core$1.Registry).createSlot(json.slot);
|
|
@@ -969,7 +1469,9 @@ class ParagraphComponent extends core$1.Component {
|
|
|
969
1469
|
slot: afterSlot
|
|
970
1470
|
});
|
|
971
1471
|
if (isEmpty && (this.parentComponent instanceof BlockquoteComponent ||
|
|
972
|
-
this.parentComponent instanceof HighlightBoxComponent
|
|
1472
|
+
this.parentComponent instanceof HighlightBoxComponent ||
|
|
1473
|
+
this.parentComponent instanceof TimelineComponent ||
|
|
1474
|
+
this.parentComponent instanceof StepComponent)) {
|
|
973
1475
|
commander.insertAfter(nextParagraph, this.parentComponent);
|
|
974
1476
|
commander.removeComponent(this);
|
|
975
1477
|
}
|
|
@@ -3155,7 +3657,7 @@ const backgroundColorFormatter = new core$1.Formatter('backgroundColor', {
|
|
|
3155
3657
|
});
|
|
3156
3658
|
const backgroundColorFormatLoader = {
|
|
3157
3659
|
match(element) {
|
|
3158
|
-
return !!element.style.backgroundColor;
|
|
3660
|
+
return element.tagName !== 'TD' && element.tagName !== 'TH' && !!element.style.backgroundColor;
|
|
3159
3661
|
},
|
|
3160
3662
|
read(element) {
|
|
3161
3663
|
return {
|
|
@@ -3165,50 +3667,6 @@ const backgroundColorFormatLoader = {
|
|
|
3165
3667
|
}
|
|
3166
3668
|
};
|
|
3167
3669
|
|
|
3168
|
-
const boldFormatter = new core$1.Formatter('bold', {
|
|
3169
|
-
render(children) {
|
|
3170
|
-
return core$1.createVNode('strong', null, children);
|
|
3171
|
-
}
|
|
3172
|
-
});
|
|
3173
|
-
function toggleBold(textbus) {
|
|
3174
|
-
const controller = textbus.get(core$1.Controller);
|
|
3175
|
-
if (controller.readonly) {
|
|
3176
|
-
return;
|
|
3177
|
-
}
|
|
3178
|
-
const query = textbus.get(core$1.Query);
|
|
3179
|
-
const commander = textbus.get(core$1.Commander);
|
|
3180
|
-
const state = query.queryFormat(boldFormatter);
|
|
3181
|
-
if (state.state === core$1.QueryStateType.Normal) {
|
|
3182
|
-
commander.applyFormat(boldFormatter, true);
|
|
3183
|
-
}
|
|
3184
|
-
else {
|
|
3185
|
-
commander.unApplyFormat(boldFormatter);
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
function registerBoldShortcut(textbus) {
|
|
3189
|
-
const keyboard = textbus.get(core$1.Keyboard);
|
|
3190
|
-
keyboard.addShortcut({
|
|
3191
|
-
keymap: {
|
|
3192
|
-
modKey: true,
|
|
3193
|
-
key: 'b'
|
|
3194
|
-
},
|
|
3195
|
-
action: () => {
|
|
3196
|
-
toggleBold(textbus);
|
|
3197
|
-
}
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
|
-
const boldFormatLoader = {
|
|
3201
|
-
match(element) {
|
|
3202
|
-
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
3203
|
-
},
|
|
3204
|
-
read() {
|
|
3205
|
-
return {
|
|
3206
|
-
formatter: boldFormatter,
|
|
3207
|
-
value: true
|
|
3208
|
-
};
|
|
3209
|
-
}
|
|
3210
|
-
};
|
|
3211
|
-
|
|
3212
3670
|
const codeFormatter = new core$1.Formatter('code', {
|
|
3213
3671
|
inheritable: false,
|
|
3214
3672
|
render(children) {
|
|
@@ -3256,28 +3714,6 @@ const codeFormatLoader = {
|
|
|
3256
3714
|
}
|
|
3257
3715
|
};
|
|
3258
3716
|
|
|
3259
|
-
const colorFormatter = new core$1.Formatter('color', {
|
|
3260
|
-
render(children, formatValue) {
|
|
3261
|
-
return {
|
|
3262
|
-
fallbackTagName: 'span',
|
|
3263
|
-
attach(host) {
|
|
3264
|
-
host.styles.set('color', formatValue);
|
|
3265
|
-
}
|
|
3266
|
-
};
|
|
3267
|
-
}
|
|
3268
|
-
});
|
|
3269
|
-
const colorFormatLoader = {
|
|
3270
|
-
match(element) {
|
|
3271
|
-
return !!element.style.color;
|
|
3272
|
-
},
|
|
3273
|
-
read(element) {
|
|
3274
|
-
return {
|
|
3275
|
-
formatter: colorFormatter,
|
|
3276
|
-
value: element.style.color
|
|
3277
|
-
};
|
|
3278
|
-
}
|
|
3279
|
-
};
|
|
3280
|
-
|
|
3281
3717
|
const fontFamilyFormatter = new core$1.Formatter('fontFamily', {
|
|
3282
3718
|
render(children, formatValue) {
|
|
3283
3719
|
return {
|
|
@@ -3300,28 +3736,6 @@ const fontFamilyFormatLoader = {
|
|
|
3300
3736
|
}
|
|
3301
3737
|
};
|
|
3302
3738
|
|
|
3303
|
-
const fontSizeFormatter = new core$1.Formatter('fontSize', {
|
|
3304
|
-
render(children, formatValue) {
|
|
3305
|
-
return {
|
|
3306
|
-
fallbackTagName: 'span',
|
|
3307
|
-
attach(host) {
|
|
3308
|
-
host.styles.set('fontSize', formatValue);
|
|
3309
|
-
}
|
|
3310
|
-
};
|
|
3311
|
-
}
|
|
3312
|
-
});
|
|
3313
|
-
const fontSizeFormatLoader = {
|
|
3314
|
-
match(element) {
|
|
3315
|
-
return !!element.style.fontSize;
|
|
3316
|
-
},
|
|
3317
|
-
read(element) {
|
|
3318
|
-
return {
|
|
3319
|
-
formatter: fontSizeFormatter,
|
|
3320
|
-
value: element.style.fontSize
|
|
3321
|
-
};
|
|
3322
|
-
}
|
|
3323
|
-
};
|
|
3324
|
-
|
|
3325
3739
|
const italicFormatter = new core$1.Formatter('italic', {
|
|
3326
3740
|
render(children) {
|
|
3327
3741
|
return core$1.createVNode('em', null, children);
|
|
@@ -3968,6 +4382,36 @@ function CellAlignTool() {
|
|
|
3968
4382
|
};
|
|
3969
4383
|
}
|
|
3970
4384
|
|
|
4385
|
+
const cellBackgroundAttr = new core$1.Attribute('cellBackground', {
|
|
4386
|
+
render(node, formatValue) {
|
|
4387
|
+
const rgba = color.parseCss(formatValue);
|
|
4388
|
+
if (rgba) {
|
|
4389
|
+
const hsl = color.rgb2Hsl(rgba);
|
|
4390
|
+
if (hsl.l > 50) {
|
|
4391
|
+
hsl.l -= 10;
|
|
4392
|
+
}
|
|
4393
|
+
else {
|
|
4394
|
+
hsl.l += Math.max((50 - hsl.l) * 0.55, 10);
|
|
4395
|
+
}
|
|
4396
|
+
hsl.s *= 0.7;
|
|
4397
|
+
const newRgba = color.hsl2Rgb(hsl);
|
|
4398
|
+
node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a || 1})`);
|
|
4399
|
+
}
|
|
4400
|
+
node.styles.set('backgroundColor', formatValue);
|
|
4401
|
+
}
|
|
4402
|
+
});
|
|
4403
|
+
const cellBackgroundAttrLoader = {
|
|
4404
|
+
match(element) {
|
|
4405
|
+
return (element.tagName === 'TD' || element.tagName === 'TH') && !!element.style.backgroundColor;
|
|
4406
|
+
},
|
|
4407
|
+
read(element) {
|
|
4408
|
+
return {
|
|
4409
|
+
attribute: cellBackgroundAttr,
|
|
4410
|
+
value: element.style.backgroundColor
|
|
4411
|
+
};
|
|
4412
|
+
}
|
|
4413
|
+
};
|
|
4414
|
+
|
|
3971
4415
|
function CellBackgroundTool() {
|
|
3972
4416
|
const refreshService = core.inject(exports.RefreshService);
|
|
3973
4417
|
const selection = core.inject(core$1.Selection);
|
|
@@ -3975,16 +4419,24 @@ function CellBackgroundTool() {
|
|
|
3975
4419
|
highlight: false,
|
|
3976
4420
|
disabled: false,
|
|
3977
4421
|
});
|
|
3978
|
-
function
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4422
|
+
function setColor(picker) {
|
|
4423
|
+
const commonAncestorComponent = selection.commonAncestorComponent;
|
|
4424
|
+
if (commonAncestorComponent instanceof TableComponent) {
|
|
4425
|
+
const slots = commonAncestorComponent.getSelectedNormalizedSlots();
|
|
4426
|
+
if (slots) {
|
|
4427
|
+
slots.map(i => {
|
|
4428
|
+
return i.cells.filter(t => t.visible).map(i => i.raw.slot);
|
|
4429
|
+
}).flat().forEach(slot => {
|
|
4430
|
+
const rgba = picker.rgba;
|
|
4431
|
+
if (rgba) {
|
|
4432
|
+
slot.setAttribute(cellBackgroundAttr, `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`);
|
|
4433
|
+
}
|
|
4434
|
+
else {
|
|
4435
|
+
slot.removeAttribute(cellBackgroundAttr);
|
|
4436
|
+
}
|
|
4437
|
+
});
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
3988
4440
|
}
|
|
3989
4441
|
const sub = refreshService.onRefresh.subscribe(() => {
|
|
3990
4442
|
const commonAncestorComponent = selection.commonAncestorComponent;
|
|
@@ -3997,7 +4449,7 @@ function CellBackgroundTool() {
|
|
|
3997
4449
|
});
|
|
3998
4450
|
return () => {
|
|
3999
4451
|
const vm = viewModel();
|
|
4000
|
-
return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled,
|
|
4452
|
+
return (jsxRuntime.jsx(Dropdown, { width: '177px', menu: jsxRuntime.jsx(ColorPicker, { onSelected: setColor }), trigger: 'hover', children: jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, children: jsxRuntime.jsx("span", { class: "xnote-icon-palette" }) }) }));
|
|
4001
4453
|
};
|
|
4002
4454
|
}
|
|
4003
4455
|
|
|
@@ -4314,78 +4766,6 @@ const katexComponentLoader = {
|
|
|
4314
4766
|
}
|
|
4315
4767
|
};
|
|
4316
4768
|
|
|
4317
|
-
function createTimelineItem(textbus, theme) {
|
|
4318
|
-
const slot = new core$1.Slot([
|
|
4319
|
-
core$1.ContentType.BlockComponent,
|
|
4320
|
-
]);
|
|
4321
|
-
const title = new ParagraphComponent(textbus);
|
|
4322
|
-
title.state.slot.insert('时间主题', [
|
|
4323
|
-
[fontSizeFormatter, '18px'],
|
|
4324
|
-
[boldFormatter, true]
|
|
4325
|
-
]);
|
|
4326
|
-
title.state.slot.insert(' 2020-02-02', [
|
|
4327
|
-
[fontSizeFormatter, '15px'],
|
|
4328
|
-
[colorFormatter, '#777']
|
|
4329
|
-
]);
|
|
4330
|
-
const desc = new ParagraphComponent(textbus);
|
|
4331
|
-
desc.state.slot.insert('描述信息...');
|
|
4332
|
-
slot.insert(title);
|
|
4333
|
-
slot.insert(desc);
|
|
4334
|
-
return { theme, slot };
|
|
4335
|
-
}
|
|
4336
|
-
class TimelineComponent extends core$1.Component {
|
|
4337
|
-
static fromJSON(textbus, json) {
|
|
4338
|
-
const registry = textbus.get(core$1.Registry);
|
|
4339
|
-
return new TimelineComponent(textbus, {
|
|
4340
|
-
items: json.items.map(i => {
|
|
4341
|
-
return {
|
|
4342
|
-
theme: i.theme,
|
|
4343
|
-
slot: registry.createSlot(i.slot)
|
|
4344
|
-
};
|
|
4345
|
-
})
|
|
4346
|
-
});
|
|
4347
|
-
}
|
|
4348
|
-
getSlots() {
|
|
4349
|
-
return this.state.items.map(i => i.slot);
|
|
4350
|
-
}
|
|
4351
|
-
}
|
|
4352
|
-
TimelineComponent.componentName = 'TimelineComponent';
|
|
4353
|
-
TimelineComponent.type = core$1.ContentType.BlockComponent;
|
|
4354
|
-
|
|
4355
|
-
function createStepItem(textbus) {
|
|
4356
|
-
const slot = new core$1.Slot([
|
|
4357
|
-
core$1.ContentType.BlockComponent
|
|
4358
|
-
]);
|
|
4359
|
-
const title = new ParagraphComponent(textbus);
|
|
4360
|
-
title.state.slot.insert('标题', [
|
|
4361
|
-
[fontSizeFormatter, '18px'],
|
|
4362
|
-
[boldFormatter, true]
|
|
4363
|
-
]);
|
|
4364
|
-
const content = new ParagraphComponent(textbus);
|
|
4365
|
-
content.state.slot.insert('描述信息...');
|
|
4366
|
-
slot.insert(title);
|
|
4367
|
-
slot.insert(content);
|
|
4368
|
-
return { slot };
|
|
4369
|
-
}
|
|
4370
|
-
class StepComponent extends core$1.Component {
|
|
4371
|
-
static fromJSON(textbus, json) {
|
|
4372
|
-
const registry = textbus.get(core$1.Registry);
|
|
4373
|
-
return new StepComponent(textbus, {
|
|
4374
|
-
step: json.step,
|
|
4375
|
-
items: json.items.map(i => {
|
|
4376
|
-
return {
|
|
4377
|
-
slot: registry.createSlot(i.slot)
|
|
4378
|
-
};
|
|
4379
|
-
})
|
|
4380
|
-
});
|
|
4381
|
-
}
|
|
4382
|
-
getSlots() {
|
|
4383
|
-
return this.state.items.map(i => i.slot);
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4386
|
-
StepComponent.componentName = 'StepComponent';
|
|
4387
|
-
StepComponent.type = core$1.ContentType.BlockComponent;
|
|
4388
|
-
|
|
4389
4769
|
function InsertTool(props) {
|
|
4390
4770
|
const commander = core.inject(core$1.Commander);
|
|
4391
4771
|
const selection = core.inject(core$1.Selection);
|
|
@@ -4995,7 +5375,7 @@ const Toolbar = core.withAnnotation({
|
|
|
4995
5375
|
opacity: p.opacity,
|
|
4996
5376
|
display: editorService.hideInlineToolbar ? 'none' : '',
|
|
4997
5377
|
transitionDuration: p.transitionDuration + 's'
|
|
4998
|
-
}, children: [selection.commonAncestorComponent instanceof TableComponent && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table"), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, { hideToolbar: hideToolbar }) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) })] }));
|
|
5378
|
+
}, children: [selection.commonAncestorComponent instanceof TableComponent && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellBackgroundTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table"), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, { hideToolbar: hideToolbar }) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) })] }));
|
|
4999
5379
|
});
|
|
5000
5380
|
});
|
|
5001
5381
|
|
|
@@ -6046,7 +6426,9 @@ const TableComponentView = core.withAnnotation({
|
|
|
6046
6426
|
], children: [jsxRuntime.jsx("colgroup", { children: state.columnsConfig.map(w => {
|
|
6047
6427
|
return jsxRuntime.jsx("col", { style: { width: w + 'px', minWidth: w + 'px' } });
|
|
6048
6428
|
}) }), jsxRuntime.jsx("tbody", { children: normalizedData.map((row) => {
|
|
6049
|
-
return (jsxRuntime.jsx("tr", { children: row.cells.
|
|
6429
|
+
return (jsxRuntime.jsx("tr", { children: row.cells.filter(i => {
|
|
6430
|
+
return i.visible;
|
|
6431
|
+
}).map(cell => {
|
|
6050
6432
|
return adapter.slotRender(cell.raw.slot, children => {
|
|
6051
6433
|
return core$1.createVNode('td', {
|
|
6052
6434
|
key: cell.raw.id,
|
|
@@ -6113,6 +6495,9 @@ const tableComponentLoader = {
|
|
|
6113
6495
|
core$1.ContentType.Text
|
|
6114
6496
|
]), cell).toDelta();
|
|
6115
6497
|
const results = deltaToBlock(delta, textbus);
|
|
6498
|
+
delta.attributes.forEach((value, key) => {
|
|
6499
|
+
slot.setAttribute(key, value);
|
|
6500
|
+
});
|
|
6116
6501
|
results.forEach(i => {
|
|
6117
6502
|
slot.insert(i);
|
|
6118
6503
|
});
|
|
@@ -6141,6 +6526,9 @@ const tableComponentLoader = {
|
|
|
6141
6526
|
core$1.ContentType.Text
|
|
6142
6527
|
]), cell).toDelta();
|
|
6143
6528
|
const results = deltaToBlock(delta, textbus);
|
|
6529
|
+
delta.attributes.forEach((value, key) => {
|
|
6530
|
+
slot.setAttribute(key, value);
|
|
6531
|
+
});
|
|
6144
6532
|
results.forEach(i => {
|
|
6145
6533
|
slot.insert(i);
|
|
6146
6534
|
});
|
|
@@ -6441,6 +6829,7 @@ class Editor extends core$1.Textbus {
|
|
|
6441
6829
|
strikeThroughFormatLoader,
|
|
6442
6830
|
underlineFormatLoader
|
|
6443
6831
|
], attributeLoaders: [
|
|
6832
|
+
cellBackgroundAttrLoader,
|
|
6444
6833
|
cellAlignAttrLoader,
|
|
6445
6834
|
headingAttrLoader,
|
|
6446
6835
|
textAlignAttrLoader,
|
|
@@ -6528,6 +6917,7 @@ class Editor extends core$1.Textbus {
|
|
|
6528
6917
|
strikeThroughFormatter,
|
|
6529
6918
|
underlineFormatter
|
|
6530
6919
|
], attributes: [
|
|
6920
|
+
cellBackgroundAttr,
|
|
6531
6921
|
cellAlignAttr,
|
|
6532
6922
|
headingAttr,
|
|
6533
6923
|
textAlignAttr,
|
|
@@ -6599,6 +6989,7 @@ exports.Button = Button;
|
|
|
6599
6989
|
exports.CellAlignTool = CellAlignTool;
|
|
6600
6990
|
exports.CellBackgroundTool = CellBackgroundTool;
|
|
6601
6991
|
exports.CodeTool = CodeTool;
|
|
6992
|
+
exports.ColorPicker = ColorPicker;
|
|
6602
6993
|
exports.ColorTool = ColorTool;
|
|
6603
6994
|
exports.ComponentToolbar = ComponentToolbar;
|
|
6604
6995
|
exports.Divider = Divider;
|
|
@@ -6632,6 +7023,7 @@ exports.Organization = Organization;
|
|
|
6632
7023
|
exports.OutputInjectionToken = OutputInjectionToken;
|
|
6633
7024
|
exports.ParagraphComponent = ParagraphComponent;
|
|
6634
7025
|
exports.ParagraphView = ParagraphView;
|
|
7026
|
+
exports.Picker = Picker;
|
|
6635
7027
|
exports.Popup = Popup;
|
|
6636
7028
|
exports.RootComponent = RootComponent;
|
|
6637
7029
|
exports.RootView = RootView;
|
|
@@ -6658,6 +7050,8 @@ exports.boldFormatLoader = boldFormatLoader;
|
|
|
6658
7050
|
exports.boldFormatter = boldFormatter;
|
|
6659
7051
|
exports.cellAlignAttr = cellAlignAttr;
|
|
6660
7052
|
exports.cellAlignAttrLoader = cellAlignAttrLoader;
|
|
7053
|
+
exports.cellBackgroundAttr = cellBackgroundAttr;
|
|
7054
|
+
exports.cellBackgroundAttrLoader = cellBackgroundAttrLoader;
|
|
6661
7055
|
exports.codeFormatLoader = codeFormatLoader;
|
|
6662
7056
|
exports.codeFormatter = codeFormatter;
|
|
6663
7057
|
exports.colorFormatLoader = colorFormatLoader;
|