@textbus/xnote 0.1.0 → 0.1.2
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/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from '@viewfly/core/jsx-runtime';
|
|
2
2
|
import { withScopedCSS } from '@viewfly/scoped-css';
|
|
3
3
|
import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, getCurrentInstance, createRef, withAnnotation, onUpdated, onMounted, InjectionToken, ReflectiveInjector, createDynamicRef, jsx as jsx$1, viewfly, Fragment as Fragment$1, watch } from '@viewfly/core';
|
|
4
|
-
import { Subject, fromEvent, Selection, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType, merge, createVNode, Slot, Component, Registry, Query, QueryStateType, BehaviorSubject, onSlotApplyFormat, onSlotSetAttribute, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, onFocusIn, onFocusOut, onDestroy, onGetRanges,
|
|
4
|
+
import { Subject, fromEvent, Selection, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType, merge, createVNode, Slot, Component, Registry, Query, QueryStateType, Formatter, BehaviorSubject, onSlotApplyFormat, onSlotSetAttribute, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, onFocusIn, onFocusOut, onDestroy, onGetRanges, onParentSlotUpdated, Textbus, RootComponentRef, filter, map, distinctUntilChanged, sampleTime, debounceTime, throttleTime, delay, onContentInserted, onContentDeleted, switchMap, fromPromise, onCompositionStart } from '@textbus/core';
|
|
5
5
|
import { normalizeHex, hex2Hsl, hex2Rgb, hex2Hsv, hsl2Hex, hsl2Hsv, hsl2Rgb, rgb2Hsl, rgb2Hex, rgb2Hsv, hsv2Hex, hsv2Hsl, hsv2Rgb, any2Hsl, parseCss } from '@tanbo/color';
|
|
6
6
|
import { VIEW_CONTAINER, isMac, DomAdapter, Input, SelectionBridge, BrowserModule, VIEW_DOCUMENT, CollaborateSelectionAwarenessDelegate, isMobileBrowser, CollaborateCursor, Parser } from '@textbus/platform-browser';
|
|
7
7
|
import { createPortal, createApp, DomRenderer, HTMLRenderer, OutputTranslator } from '@viewfly/platform-browser';
|
|
@@ -731,8 +731,11 @@ const DropdownMenuPortal = withAnnotation({
|
|
|
731
731
|
dropdownContextService.canHide = true;
|
|
732
732
|
dropdownContextService.hide();
|
|
733
733
|
}
|
|
734
|
+
function stopPropagation(ev) {
|
|
735
|
+
ev.stopPropagation();
|
|
736
|
+
}
|
|
734
737
|
return createPortal(withScopedCSS(scopedId$i, () => {
|
|
735
|
-
return (jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
|
|
738
|
+
return (jsx("div", { onMouseenter: onEnter, onMousedown: stopPropagation, onMouseleave: onLeave, ref: menuRef, style: {
|
|
736
739
|
width: props.width
|
|
737
740
|
}, class: "dropdown-menu", children: jsx("div", { class: "dropdown-menu-content", style: {
|
|
738
741
|
padding: props.padding
|
|
@@ -1277,6 +1280,185 @@ const highlightBoxComponentLoader = {
|
|
|
1277
1280
|
}
|
|
1278
1281
|
};
|
|
1279
1282
|
|
|
1283
|
+
const fontSizeFormatter = new Formatter('fontSize', {
|
|
1284
|
+
render(children, formatValue) {
|
|
1285
|
+
return {
|
|
1286
|
+
fallbackTagName: 'span',
|
|
1287
|
+
attach(host) {
|
|
1288
|
+
host.styles.set('fontSize', formatValue);
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
const fontSizeFormatLoader = {
|
|
1294
|
+
match(element) {
|
|
1295
|
+
return !!element.style.fontSize;
|
|
1296
|
+
},
|
|
1297
|
+
read(element) {
|
|
1298
|
+
return {
|
|
1299
|
+
formatter: fontSizeFormatter,
|
|
1300
|
+
value: element.style.fontSize
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
const boldFormatter = new Formatter('bold', {
|
|
1306
|
+
render(children) {
|
|
1307
|
+
return createVNode('strong', null, children);
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
function toggleBold(textbus) {
|
|
1311
|
+
const controller = textbus.get(Controller);
|
|
1312
|
+
if (controller.readonly) {
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
const query = textbus.get(Query);
|
|
1316
|
+
const commander = textbus.get(Commander);
|
|
1317
|
+
const state = query.queryFormat(boldFormatter);
|
|
1318
|
+
if (state.state === QueryStateType.Normal) {
|
|
1319
|
+
commander.applyFormat(boldFormatter, true);
|
|
1320
|
+
}
|
|
1321
|
+
else {
|
|
1322
|
+
commander.unApplyFormat(boldFormatter);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
function registerBoldShortcut(textbus) {
|
|
1326
|
+
const keyboard = textbus.get(Keyboard);
|
|
1327
|
+
keyboard.addShortcut({
|
|
1328
|
+
keymap: {
|
|
1329
|
+
modKey: true,
|
|
1330
|
+
key: 'b'
|
|
1331
|
+
},
|
|
1332
|
+
action: () => {
|
|
1333
|
+
toggleBold(textbus);
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
const boldFormatLoader = {
|
|
1338
|
+
match(element) {
|
|
1339
|
+
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
1340
|
+
},
|
|
1341
|
+
read() {
|
|
1342
|
+
return {
|
|
1343
|
+
formatter: boldFormatter,
|
|
1344
|
+
value: true
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
const colorFormatter = new Formatter('color', {
|
|
1350
|
+
render(children, formatValue) {
|
|
1351
|
+
return {
|
|
1352
|
+
fallbackTagName: 'span',
|
|
1353
|
+
attach(host) {
|
|
1354
|
+
host.styles.set('color', formatValue);
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
const colorFormatLoader = {
|
|
1360
|
+
match(element) {
|
|
1361
|
+
return !!element.style.color;
|
|
1362
|
+
},
|
|
1363
|
+
read(element) {
|
|
1364
|
+
return {
|
|
1365
|
+
formatter: colorFormatter,
|
|
1366
|
+
value: element.style.color
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
function createTimelineItem(textbus, theme) {
|
|
1372
|
+
const slot = new Slot([
|
|
1373
|
+
ContentType.BlockComponent,
|
|
1374
|
+
]);
|
|
1375
|
+
const title = new ParagraphComponent(textbus);
|
|
1376
|
+
title.state.slot.insert('时间主题', [
|
|
1377
|
+
[fontSizeFormatter, '18px'],
|
|
1378
|
+
[boldFormatter, true]
|
|
1379
|
+
]);
|
|
1380
|
+
title.state.slot.insert(' 2020-02-02', [
|
|
1381
|
+
[fontSizeFormatter, '15px'],
|
|
1382
|
+
[colorFormatter, '#777']
|
|
1383
|
+
]);
|
|
1384
|
+
const desc = new ParagraphComponent(textbus);
|
|
1385
|
+
desc.state.slot.insert('描述信息...');
|
|
1386
|
+
slot.insert(title);
|
|
1387
|
+
slot.insert(desc);
|
|
1388
|
+
return { theme, slot };
|
|
1389
|
+
}
|
|
1390
|
+
class TimelineComponent extends Component {
|
|
1391
|
+
static fromJSON(textbus, json) {
|
|
1392
|
+
const registry = textbus.get(Registry);
|
|
1393
|
+
return new TimelineComponent(textbus, {
|
|
1394
|
+
items: json.items.map(i => {
|
|
1395
|
+
return {
|
|
1396
|
+
theme: i.theme,
|
|
1397
|
+
slot: registry.createSlot(i.slot)
|
|
1398
|
+
};
|
|
1399
|
+
})
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
getSlots() {
|
|
1403
|
+
return this.state.items.map(i => i.slot);
|
|
1404
|
+
}
|
|
1405
|
+
removeSlot(slot) {
|
|
1406
|
+
const index = this.state.items.findIndex(i => i.slot === slot);
|
|
1407
|
+
if (index >= 0) {
|
|
1408
|
+
this.state.items.splice(index, 1);
|
|
1409
|
+
return true;
|
|
1410
|
+
}
|
|
1411
|
+
return false;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
TimelineComponent.componentName = 'TimelineComponent';
|
|
1415
|
+
TimelineComponent.type = ContentType.BlockComponent;
|
|
1416
|
+
|
|
1417
|
+
function createStepItem(textbus) {
|
|
1418
|
+
const slot = new Slot([
|
|
1419
|
+
ContentType.BlockComponent
|
|
1420
|
+
]);
|
|
1421
|
+
const title = new ParagraphComponent(textbus);
|
|
1422
|
+
title.state.slot.insert('标题', [
|
|
1423
|
+
[fontSizeFormatter, '18px'],
|
|
1424
|
+
[boldFormatter, true]
|
|
1425
|
+
]);
|
|
1426
|
+
const content = new ParagraphComponent(textbus);
|
|
1427
|
+
content.state.slot.insert('描述信息...');
|
|
1428
|
+
slot.insert(title);
|
|
1429
|
+
slot.insert(content);
|
|
1430
|
+
return { slot };
|
|
1431
|
+
}
|
|
1432
|
+
class StepComponent extends Component {
|
|
1433
|
+
static fromJSON(textbus, json) {
|
|
1434
|
+
const registry = textbus.get(Registry);
|
|
1435
|
+
return new StepComponent(textbus, {
|
|
1436
|
+
step: json.step,
|
|
1437
|
+
items: json.items.map(i => {
|
|
1438
|
+
return {
|
|
1439
|
+
slot: registry.createSlot(i.slot)
|
|
1440
|
+
};
|
|
1441
|
+
})
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
getSlots() {
|
|
1445
|
+
return this.state.items.map(i => i.slot);
|
|
1446
|
+
}
|
|
1447
|
+
removeSlot(slot) {
|
|
1448
|
+
const index = this.state.items.findIndex(i => i.slot === slot);
|
|
1449
|
+
if (index >= 0) {
|
|
1450
|
+
if (index === this.state.step) {
|
|
1451
|
+
this.state.step--;
|
|
1452
|
+
}
|
|
1453
|
+
this.state.items.splice(index, 1);
|
|
1454
|
+
return true;
|
|
1455
|
+
}
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
StepComponent.componentName = 'StepComponent';
|
|
1460
|
+
StepComponent.type = ContentType.BlockComponent;
|
|
1461
|
+
|
|
1280
1462
|
class ParagraphComponent extends Component {
|
|
1281
1463
|
static fromJSON(textbus, json) {
|
|
1282
1464
|
const slot = textbus.get(Registry).createSlot(json.slot);
|
|
@@ -1307,7 +1489,9 @@ class ParagraphComponent extends Component {
|
|
|
1307
1489
|
slot: afterSlot
|
|
1308
1490
|
});
|
|
1309
1491
|
if (isEmpty && (this.parentComponent instanceof BlockquoteComponent ||
|
|
1310
|
-
this.parentComponent instanceof HighlightBoxComponent
|
|
1492
|
+
this.parentComponent instanceof HighlightBoxComponent ||
|
|
1493
|
+
this.parentComponent instanceof TimelineComponent ||
|
|
1494
|
+
this.parentComponent instanceof StepComponent)) {
|
|
1311
1495
|
commander.insertAfter(nextParagraph, this.parentComponent);
|
|
1312
1496
|
commander.removeComponent(this);
|
|
1313
1497
|
}
|
|
@@ -3493,7 +3677,7 @@ const backgroundColorFormatter = new Formatter('backgroundColor', {
|
|
|
3493
3677
|
});
|
|
3494
3678
|
const backgroundColorFormatLoader = {
|
|
3495
3679
|
match(element) {
|
|
3496
|
-
return element.tagName !== 'TD' && !!element.style.backgroundColor;
|
|
3680
|
+
return element.tagName !== 'TD' && element.tagName !== 'TH' && !!element.style.backgroundColor;
|
|
3497
3681
|
},
|
|
3498
3682
|
read(element) {
|
|
3499
3683
|
return {
|
|
@@ -3503,50 +3687,6 @@ const backgroundColorFormatLoader = {
|
|
|
3503
3687
|
}
|
|
3504
3688
|
};
|
|
3505
3689
|
|
|
3506
|
-
const boldFormatter = new Formatter('bold', {
|
|
3507
|
-
render(children) {
|
|
3508
|
-
return createVNode('strong', null, children);
|
|
3509
|
-
}
|
|
3510
|
-
});
|
|
3511
|
-
function toggleBold(textbus) {
|
|
3512
|
-
const controller = textbus.get(Controller);
|
|
3513
|
-
if (controller.readonly) {
|
|
3514
|
-
return;
|
|
3515
|
-
}
|
|
3516
|
-
const query = textbus.get(Query);
|
|
3517
|
-
const commander = textbus.get(Commander);
|
|
3518
|
-
const state = query.queryFormat(boldFormatter);
|
|
3519
|
-
if (state.state === QueryStateType.Normal) {
|
|
3520
|
-
commander.applyFormat(boldFormatter, true);
|
|
3521
|
-
}
|
|
3522
|
-
else {
|
|
3523
|
-
commander.unApplyFormat(boldFormatter);
|
|
3524
|
-
}
|
|
3525
|
-
}
|
|
3526
|
-
function registerBoldShortcut(textbus) {
|
|
3527
|
-
const keyboard = textbus.get(Keyboard);
|
|
3528
|
-
keyboard.addShortcut({
|
|
3529
|
-
keymap: {
|
|
3530
|
-
modKey: true,
|
|
3531
|
-
key: 'b'
|
|
3532
|
-
},
|
|
3533
|
-
action: () => {
|
|
3534
|
-
toggleBold(textbus);
|
|
3535
|
-
}
|
|
3536
|
-
});
|
|
3537
|
-
}
|
|
3538
|
-
const boldFormatLoader = {
|
|
3539
|
-
match(element) {
|
|
3540
|
-
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
3541
|
-
},
|
|
3542
|
-
read() {
|
|
3543
|
-
return {
|
|
3544
|
-
formatter: boldFormatter,
|
|
3545
|
-
value: true
|
|
3546
|
-
};
|
|
3547
|
-
}
|
|
3548
|
-
};
|
|
3549
|
-
|
|
3550
3690
|
const codeFormatter = new Formatter('code', {
|
|
3551
3691
|
inheritable: false,
|
|
3552
3692
|
render(children) {
|
|
@@ -3594,28 +3734,6 @@ const codeFormatLoader = {
|
|
|
3594
3734
|
}
|
|
3595
3735
|
};
|
|
3596
3736
|
|
|
3597
|
-
const colorFormatter = new Formatter('color', {
|
|
3598
|
-
render(children, formatValue) {
|
|
3599
|
-
return {
|
|
3600
|
-
fallbackTagName: 'span',
|
|
3601
|
-
attach(host) {
|
|
3602
|
-
host.styles.set('color', formatValue);
|
|
3603
|
-
}
|
|
3604
|
-
};
|
|
3605
|
-
}
|
|
3606
|
-
});
|
|
3607
|
-
const colorFormatLoader = {
|
|
3608
|
-
match(element) {
|
|
3609
|
-
return !!element.style.color;
|
|
3610
|
-
},
|
|
3611
|
-
read(element) {
|
|
3612
|
-
return {
|
|
3613
|
-
formatter: colorFormatter,
|
|
3614
|
-
value: element.style.color
|
|
3615
|
-
};
|
|
3616
|
-
}
|
|
3617
|
-
};
|
|
3618
|
-
|
|
3619
3737
|
const fontFamilyFormatter = new Formatter('fontFamily', {
|
|
3620
3738
|
render(children, formatValue) {
|
|
3621
3739
|
return {
|
|
@@ -3638,28 +3756,6 @@ const fontFamilyFormatLoader = {
|
|
|
3638
3756
|
}
|
|
3639
3757
|
};
|
|
3640
3758
|
|
|
3641
|
-
const fontSizeFormatter = new Formatter('fontSize', {
|
|
3642
|
-
render(children, formatValue) {
|
|
3643
|
-
return {
|
|
3644
|
-
fallbackTagName: 'span',
|
|
3645
|
-
attach(host) {
|
|
3646
|
-
host.styles.set('fontSize', formatValue);
|
|
3647
|
-
}
|
|
3648
|
-
};
|
|
3649
|
-
}
|
|
3650
|
-
});
|
|
3651
|
-
const fontSizeFormatLoader = {
|
|
3652
|
-
match(element) {
|
|
3653
|
-
return !!element.style.fontSize;
|
|
3654
|
-
},
|
|
3655
|
-
read(element) {
|
|
3656
|
-
return {
|
|
3657
|
-
formatter: fontSizeFormatter,
|
|
3658
|
-
value: element.style.fontSize
|
|
3659
|
-
};
|
|
3660
|
-
}
|
|
3661
|
-
};
|
|
3662
|
-
|
|
3663
3759
|
const italicFormatter = new Formatter('italic', {
|
|
3664
3760
|
render(children) {
|
|
3665
3761
|
return createVNode('em', null, children);
|
|
@@ -4319,14 +4415,14 @@ const cellBackgroundAttr = new Attribute('cellBackground', {
|
|
|
4319
4415
|
}
|
|
4320
4416
|
hsl.s *= 0.7;
|
|
4321
4417
|
const newRgba = hsl2Rgb(hsl);
|
|
4322
|
-
node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a})`);
|
|
4418
|
+
node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a || 1})`);
|
|
4323
4419
|
}
|
|
4324
4420
|
node.styles.set('backgroundColor', formatValue);
|
|
4325
4421
|
}
|
|
4326
4422
|
});
|
|
4327
4423
|
const cellBackgroundAttrLoader = {
|
|
4328
4424
|
match(element) {
|
|
4329
|
-
return element
|
|
4425
|
+
return (element.tagName === 'TD' || element.tagName === 'TH') && !!element.style.backgroundColor;
|
|
4330
4426
|
},
|
|
4331
4427
|
read(element) {
|
|
4332
4428
|
return {
|
|
@@ -4690,78 +4786,6 @@ const katexComponentLoader = {
|
|
|
4690
4786
|
}
|
|
4691
4787
|
};
|
|
4692
4788
|
|
|
4693
|
-
function createTimelineItem(textbus, theme) {
|
|
4694
|
-
const slot = new Slot([
|
|
4695
|
-
ContentType.BlockComponent,
|
|
4696
|
-
]);
|
|
4697
|
-
const title = new ParagraphComponent(textbus);
|
|
4698
|
-
title.state.slot.insert('时间主题', [
|
|
4699
|
-
[fontSizeFormatter, '18px'],
|
|
4700
|
-
[boldFormatter, true]
|
|
4701
|
-
]);
|
|
4702
|
-
title.state.slot.insert(' 2020-02-02', [
|
|
4703
|
-
[fontSizeFormatter, '15px'],
|
|
4704
|
-
[colorFormatter, '#777']
|
|
4705
|
-
]);
|
|
4706
|
-
const desc = new ParagraphComponent(textbus);
|
|
4707
|
-
desc.state.slot.insert('描述信息...');
|
|
4708
|
-
slot.insert(title);
|
|
4709
|
-
slot.insert(desc);
|
|
4710
|
-
return { theme, slot };
|
|
4711
|
-
}
|
|
4712
|
-
class TimelineComponent extends Component {
|
|
4713
|
-
static fromJSON(textbus, json) {
|
|
4714
|
-
const registry = textbus.get(Registry);
|
|
4715
|
-
return new TimelineComponent(textbus, {
|
|
4716
|
-
items: json.items.map(i => {
|
|
4717
|
-
return {
|
|
4718
|
-
theme: i.theme,
|
|
4719
|
-
slot: registry.createSlot(i.slot)
|
|
4720
|
-
};
|
|
4721
|
-
})
|
|
4722
|
-
});
|
|
4723
|
-
}
|
|
4724
|
-
getSlots() {
|
|
4725
|
-
return this.state.items.map(i => i.slot);
|
|
4726
|
-
}
|
|
4727
|
-
}
|
|
4728
|
-
TimelineComponent.componentName = 'TimelineComponent';
|
|
4729
|
-
TimelineComponent.type = ContentType.BlockComponent;
|
|
4730
|
-
|
|
4731
|
-
function createStepItem(textbus) {
|
|
4732
|
-
const slot = new Slot([
|
|
4733
|
-
ContentType.BlockComponent
|
|
4734
|
-
]);
|
|
4735
|
-
const title = new ParagraphComponent(textbus);
|
|
4736
|
-
title.state.slot.insert('标题', [
|
|
4737
|
-
[fontSizeFormatter, '18px'],
|
|
4738
|
-
[boldFormatter, true]
|
|
4739
|
-
]);
|
|
4740
|
-
const content = new ParagraphComponent(textbus);
|
|
4741
|
-
content.state.slot.insert('描述信息...');
|
|
4742
|
-
slot.insert(title);
|
|
4743
|
-
slot.insert(content);
|
|
4744
|
-
return { slot };
|
|
4745
|
-
}
|
|
4746
|
-
class StepComponent extends Component {
|
|
4747
|
-
static fromJSON(textbus, json) {
|
|
4748
|
-
const registry = textbus.get(Registry);
|
|
4749
|
-
return new StepComponent(textbus, {
|
|
4750
|
-
step: json.step,
|
|
4751
|
-
items: json.items.map(i => {
|
|
4752
|
-
return {
|
|
4753
|
-
slot: registry.createSlot(i.slot)
|
|
4754
|
-
};
|
|
4755
|
-
})
|
|
4756
|
-
});
|
|
4757
|
-
}
|
|
4758
|
-
getSlots() {
|
|
4759
|
-
return this.state.items.map(i => i.slot);
|
|
4760
|
-
}
|
|
4761
|
-
}
|
|
4762
|
-
StepComponent.componentName = 'StepComponent';
|
|
4763
|
-
StepComponent.type = ContentType.BlockComponent;
|
|
4764
|
-
|
|
4765
4789
|
function InsertTool(props) {
|
|
4766
4790
|
const commander = inject(Commander);
|
|
4767
4791
|
const selection = inject(Selection);
|
|
@@ -6422,7 +6446,9 @@ const TableComponentView = withAnnotation({
|
|
|
6422
6446
|
], children: [jsx("colgroup", { children: state.columnsConfig.map(w => {
|
|
6423
6447
|
return jsx("col", { style: { width: w + 'px', minWidth: w + 'px' } });
|
|
6424
6448
|
}) }), jsx("tbody", { children: normalizedData.map((row) => {
|
|
6425
|
-
return (jsx("tr", { children: row.cells.
|
|
6449
|
+
return (jsx("tr", { children: row.cells.filter(i => {
|
|
6450
|
+
return i.visible;
|
|
6451
|
+
}).map(cell => {
|
|
6426
6452
|
return adapter.slotRender(cell.raw.slot, children => {
|
|
6427
6453
|
return createVNode('td', {
|
|
6428
6454
|
key: cell.raw.id,
|
|
@@ -6489,6 +6515,9 @@ const tableComponentLoader = {
|
|
|
6489
6515
|
ContentType.Text
|
|
6490
6516
|
]), cell).toDelta();
|
|
6491
6517
|
const results = deltaToBlock(delta, textbus);
|
|
6518
|
+
delta.attributes.forEach((value, key) => {
|
|
6519
|
+
slot.setAttribute(key, value);
|
|
6520
|
+
});
|
|
6492
6521
|
results.forEach(i => {
|
|
6493
6522
|
slot.insert(i);
|
|
6494
6523
|
});
|
|
@@ -6517,6 +6546,9 @@ const tableComponentLoader = {
|
|
|
6517
6546
|
ContentType.Text
|
|
6518
6547
|
]), cell).toDelta();
|
|
6519
6548
|
const results = deltaToBlock(delta, textbus);
|
|
6549
|
+
delta.attributes.forEach((value, key) => {
|
|
6550
|
+
slot.setAttribute(key, value);
|
|
6551
|
+
});
|
|
6520
6552
|
results.forEach(i => {
|
|
6521
6553
|
slot.insert(i);
|
|
6522
6554
|
});
|
package/bundles/index.js
CHANGED
|
@@ -733,8 +733,11 @@ const DropdownMenuPortal = core.withAnnotation({
|
|
|
733
733
|
dropdownContextService.canHide = true;
|
|
734
734
|
dropdownContextService.hide();
|
|
735
735
|
}
|
|
736
|
+
function stopPropagation(ev) {
|
|
737
|
+
ev.stopPropagation();
|
|
738
|
+
}
|
|
736
739
|
return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$i, () => {
|
|
737
|
-
return (jsxRuntime.jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
|
|
740
|
+
return (jsxRuntime.jsx("div", { onMouseenter: onEnter, onMousedown: stopPropagation, onMouseleave: onLeave, ref: menuRef, style: {
|
|
738
741
|
width: props.width
|
|
739
742
|
}, class: "dropdown-menu", children: jsxRuntime.jsx("div", { class: "dropdown-menu-content", style: {
|
|
740
743
|
padding: props.padding
|
|
@@ -1279,6 +1282,185 @@ const highlightBoxComponentLoader = {
|
|
|
1279
1282
|
}
|
|
1280
1283
|
};
|
|
1281
1284
|
|
|
1285
|
+
const fontSizeFormatter = new core$1.Formatter('fontSize', {
|
|
1286
|
+
render(children, formatValue) {
|
|
1287
|
+
return {
|
|
1288
|
+
fallbackTagName: 'span',
|
|
1289
|
+
attach(host) {
|
|
1290
|
+
host.styles.set('fontSize', formatValue);
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
const fontSizeFormatLoader = {
|
|
1296
|
+
match(element) {
|
|
1297
|
+
return !!element.style.fontSize;
|
|
1298
|
+
},
|
|
1299
|
+
read(element) {
|
|
1300
|
+
return {
|
|
1301
|
+
formatter: fontSizeFormatter,
|
|
1302
|
+
value: element.style.fontSize
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
const boldFormatter = new core$1.Formatter('bold', {
|
|
1308
|
+
render(children) {
|
|
1309
|
+
return core$1.createVNode('strong', null, children);
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
function toggleBold(textbus) {
|
|
1313
|
+
const controller = textbus.get(core$1.Controller);
|
|
1314
|
+
if (controller.readonly) {
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
const query = textbus.get(core$1.Query);
|
|
1318
|
+
const commander = textbus.get(core$1.Commander);
|
|
1319
|
+
const state = query.queryFormat(boldFormatter);
|
|
1320
|
+
if (state.state === core$1.QueryStateType.Normal) {
|
|
1321
|
+
commander.applyFormat(boldFormatter, true);
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
commander.unApplyFormat(boldFormatter);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
function registerBoldShortcut(textbus) {
|
|
1328
|
+
const keyboard = textbus.get(core$1.Keyboard);
|
|
1329
|
+
keyboard.addShortcut({
|
|
1330
|
+
keymap: {
|
|
1331
|
+
modKey: true,
|
|
1332
|
+
key: 'b'
|
|
1333
|
+
},
|
|
1334
|
+
action: () => {
|
|
1335
|
+
toggleBold(textbus);
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
const boldFormatLoader = {
|
|
1340
|
+
match(element) {
|
|
1341
|
+
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
1342
|
+
},
|
|
1343
|
+
read() {
|
|
1344
|
+
return {
|
|
1345
|
+
formatter: boldFormatter,
|
|
1346
|
+
value: true
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
const colorFormatter = new core$1.Formatter('color', {
|
|
1352
|
+
render(children, formatValue) {
|
|
1353
|
+
return {
|
|
1354
|
+
fallbackTagName: 'span',
|
|
1355
|
+
attach(host) {
|
|
1356
|
+
host.styles.set('color', formatValue);
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
const colorFormatLoader = {
|
|
1362
|
+
match(element) {
|
|
1363
|
+
return !!element.style.color;
|
|
1364
|
+
},
|
|
1365
|
+
read(element) {
|
|
1366
|
+
return {
|
|
1367
|
+
formatter: colorFormatter,
|
|
1368
|
+
value: element.style.color
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
function createTimelineItem(textbus, theme) {
|
|
1374
|
+
const slot = new core$1.Slot([
|
|
1375
|
+
core$1.ContentType.BlockComponent,
|
|
1376
|
+
]);
|
|
1377
|
+
const title = new ParagraphComponent(textbus);
|
|
1378
|
+
title.state.slot.insert('时间主题', [
|
|
1379
|
+
[fontSizeFormatter, '18px'],
|
|
1380
|
+
[boldFormatter, true]
|
|
1381
|
+
]);
|
|
1382
|
+
title.state.slot.insert(' 2020-02-02', [
|
|
1383
|
+
[fontSizeFormatter, '15px'],
|
|
1384
|
+
[colorFormatter, '#777']
|
|
1385
|
+
]);
|
|
1386
|
+
const desc = new ParagraphComponent(textbus);
|
|
1387
|
+
desc.state.slot.insert('描述信息...');
|
|
1388
|
+
slot.insert(title);
|
|
1389
|
+
slot.insert(desc);
|
|
1390
|
+
return { theme, slot };
|
|
1391
|
+
}
|
|
1392
|
+
class TimelineComponent extends core$1.Component {
|
|
1393
|
+
static fromJSON(textbus, json) {
|
|
1394
|
+
const registry = textbus.get(core$1.Registry);
|
|
1395
|
+
return new TimelineComponent(textbus, {
|
|
1396
|
+
items: json.items.map(i => {
|
|
1397
|
+
return {
|
|
1398
|
+
theme: i.theme,
|
|
1399
|
+
slot: registry.createSlot(i.slot)
|
|
1400
|
+
};
|
|
1401
|
+
})
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
getSlots() {
|
|
1405
|
+
return this.state.items.map(i => i.slot);
|
|
1406
|
+
}
|
|
1407
|
+
removeSlot(slot) {
|
|
1408
|
+
const index = this.state.items.findIndex(i => i.slot === slot);
|
|
1409
|
+
if (index >= 0) {
|
|
1410
|
+
this.state.items.splice(index, 1);
|
|
1411
|
+
return true;
|
|
1412
|
+
}
|
|
1413
|
+
return false;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
TimelineComponent.componentName = 'TimelineComponent';
|
|
1417
|
+
TimelineComponent.type = core$1.ContentType.BlockComponent;
|
|
1418
|
+
|
|
1419
|
+
function createStepItem(textbus) {
|
|
1420
|
+
const slot = new core$1.Slot([
|
|
1421
|
+
core$1.ContentType.BlockComponent
|
|
1422
|
+
]);
|
|
1423
|
+
const title = new ParagraphComponent(textbus);
|
|
1424
|
+
title.state.slot.insert('标题', [
|
|
1425
|
+
[fontSizeFormatter, '18px'],
|
|
1426
|
+
[boldFormatter, true]
|
|
1427
|
+
]);
|
|
1428
|
+
const content = new ParagraphComponent(textbus);
|
|
1429
|
+
content.state.slot.insert('描述信息...');
|
|
1430
|
+
slot.insert(title);
|
|
1431
|
+
slot.insert(content);
|
|
1432
|
+
return { slot };
|
|
1433
|
+
}
|
|
1434
|
+
class StepComponent extends core$1.Component {
|
|
1435
|
+
static fromJSON(textbus, json) {
|
|
1436
|
+
const registry = textbus.get(core$1.Registry);
|
|
1437
|
+
return new StepComponent(textbus, {
|
|
1438
|
+
step: json.step,
|
|
1439
|
+
items: json.items.map(i => {
|
|
1440
|
+
return {
|
|
1441
|
+
slot: registry.createSlot(i.slot)
|
|
1442
|
+
};
|
|
1443
|
+
})
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
getSlots() {
|
|
1447
|
+
return this.state.items.map(i => i.slot);
|
|
1448
|
+
}
|
|
1449
|
+
removeSlot(slot) {
|
|
1450
|
+
const index = this.state.items.findIndex(i => i.slot === slot);
|
|
1451
|
+
if (index >= 0) {
|
|
1452
|
+
if (index === this.state.step) {
|
|
1453
|
+
this.state.step--;
|
|
1454
|
+
}
|
|
1455
|
+
this.state.items.splice(index, 1);
|
|
1456
|
+
return true;
|
|
1457
|
+
}
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
StepComponent.componentName = 'StepComponent';
|
|
1462
|
+
StepComponent.type = core$1.ContentType.BlockComponent;
|
|
1463
|
+
|
|
1282
1464
|
class ParagraphComponent extends core$1.Component {
|
|
1283
1465
|
static fromJSON(textbus, json) {
|
|
1284
1466
|
const slot = textbus.get(core$1.Registry).createSlot(json.slot);
|
|
@@ -1309,7 +1491,9 @@ class ParagraphComponent extends core$1.Component {
|
|
|
1309
1491
|
slot: afterSlot
|
|
1310
1492
|
});
|
|
1311
1493
|
if (isEmpty && (this.parentComponent instanceof BlockquoteComponent ||
|
|
1312
|
-
this.parentComponent instanceof HighlightBoxComponent
|
|
1494
|
+
this.parentComponent instanceof HighlightBoxComponent ||
|
|
1495
|
+
this.parentComponent instanceof TimelineComponent ||
|
|
1496
|
+
this.parentComponent instanceof StepComponent)) {
|
|
1313
1497
|
commander.insertAfter(nextParagraph, this.parentComponent);
|
|
1314
1498
|
commander.removeComponent(this);
|
|
1315
1499
|
}
|
|
@@ -3495,7 +3679,7 @@ const backgroundColorFormatter = new core$1.Formatter('backgroundColor', {
|
|
|
3495
3679
|
});
|
|
3496
3680
|
const backgroundColorFormatLoader = {
|
|
3497
3681
|
match(element) {
|
|
3498
|
-
return element.tagName !== 'TD' && !!element.style.backgroundColor;
|
|
3682
|
+
return element.tagName !== 'TD' && element.tagName !== 'TH' && !!element.style.backgroundColor;
|
|
3499
3683
|
},
|
|
3500
3684
|
read(element) {
|
|
3501
3685
|
return {
|
|
@@ -3505,50 +3689,6 @@ const backgroundColorFormatLoader = {
|
|
|
3505
3689
|
}
|
|
3506
3690
|
};
|
|
3507
3691
|
|
|
3508
|
-
const boldFormatter = new core$1.Formatter('bold', {
|
|
3509
|
-
render(children) {
|
|
3510
|
-
return core$1.createVNode('strong', null, children);
|
|
3511
|
-
}
|
|
3512
|
-
});
|
|
3513
|
-
function toggleBold(textbus) {
|
|
3514
|
-
const controller = textbus.get(core$1.Controller);
|
|
3515
|
-
if (controller.readonly) {
|
|
3516
|
-
return;
|
|
3517
|
-
}
|
|
3518
|
-
const query = textbus.get(core$1.Query);
|
|
3519
|
-
const commander = textbus.get(core$1.Commander);
|
|
3520
|
-
const state = query.queryFormat(boldFormatter);
|
|
3521
|
-
if (state.state === core$1.QueryStateType.Normal) {
|
|
3522
|
-
commander.applyFormat(boldFormatter, true);
|
|
3523
|
-
}
|
|
3524
|
-
else {
|
|
3525
|
-
commander.unApplyFormat(boldFormatter);
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
function registerBoldShortcut(textbus) {
|
|
3529
|
-
const keyboard = textbus.get(core$1.Keyboard);
|
|
3530
|
-
keyboard.addShortcut({
|
|
3531
|
-
keymap: {
|
|
3532
|
-
modKey: true,
|
|
3533
|
-
key: 'b'
|
|
3534
|
-
},
|
|
3535
|
-
action: () => {
|
|
3536
|
-
toggleBold(textbus);
|
|
3537
|
-
}
|
|
3538
|
-
});
|
|
3539
|
-
}
|
|
3540
|
-
const boldFormatLoader = {
|
|
3541
|
-
match(element) {
|
|
3542
|
-
return element.tagName === 'STRONG' || element.tagName === 'B' || /bold|[5-9]00/.test(element.style.fontWeight);
|
|
3543
|
-
},
|
|
3544
|
-
read() {
|
|
3545
|
-
return {
|
|
3546
|
-
formatter: boldFormatter,
|
|
3547
|
-
value: true
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
|
-
};
|
|
3551
|
-
|
|
3552
3692
|
const codeFormatter = new core$1.Formatter('code', {
|
|
3553
3693
|
inheritable: false,
|
|
3554
3694
|
render(children) {
|
|
@@ -3596,28 +3736,6 @@ const codeFormatLoader = {
|
|
|
3596
3736
|
}
|
|
3597
3737
|
};
|
|
3598
3738
|
|
|
3599
|
-
const colorFormatter = new core$1.Formatter('color', {
|
|
3600
|
-
render(children, formatValue) {
|
|
3601
|
-
return {
|
|
3602
|
-
fallbackTagName: 'span',
|
|
3603
|
-
attach(host) {
|
|
3604
|
-
host.styles.set('color', formatValue);
|
|
3605
|
-
}
|
|
3606
|
-
};
|
|
3607
|
-
}
|
|
3608
|
-
});
|
|
3609
|
-
const colorFormatLoader = {
|
|
3610
|
-
match(element) {
|
|
3611
|
-
return !!element.style.color;
|
|
3612
|
-
},
|
|
3613
|
-
read(element) {
|
|
3614
|
-
return {
|
|
3615
|
-
formatter: colorFormatter,
|
|
3616
|
-
value: element.style.color
|
|
3617
|
-
};
|
|
3618
|
-
}
|
|
3619
|
-
};
|
|
3620
|
-
|
|
3621
3739
|
const fontFamilyFormatter = new core$1.Formatter('fontFamily', {
|
|
3622
3740
|
render(children, formatValue) {
|
|
3623
3741
|
return {
|
|
@@ -3640,28 +3758,6 @@ const fontFamilyFormatLoader = {
|
|
|
3640
3758
|
}
|
|
3641
3759
|
};
|
|
3642
3760
|
|
|
3643
|
-
const fontSizeFormatter = new core$1.Formatter('fontSize', {
|
|
3644
|
-
render(children, formatValue) {
|
|
3645
|
-
return {
|
|
3646
|
-
fallbackTagName: 'span',
|
|
3647
|
-
attach(host) {
|
|
3648
|
-
host.styles.set('fontSize', formatValue);
|
|
3649
|
-
}
|
|
3650
|
-
};
|
|
3651
|
-
}
|
|
3652
|
-
});
|
|
3653
|
-
const fontSizeFormatLoader = {
|
|
3654
|
-
match(element) {
|
|
3655
|
-
return !!element.style.fontSize;
|
|
3656
|
-
},
|
|
3657
|
-
read(element) {
|
|
3658
|
-
return {
|
|
3659
|
-
formatter: fontSizeFormatter,
|
|
3660
|
-
value: element.style.fontSize
|
|
3661
|
-
};
|
|
3662
|
-
}
|
|
3663
|
-
};
|
|
3664
|
-
|
|
3665
3761
|
const italicFormatter = new core$1.Formatter('italic', {
|
|
3666
3762
|
render(children) {
|
|
3667
3763
|
return core$1.createVNode('em', null, children);
|
|
@@ -4321,14 +4417,14 @@ const cellBackgroundAttr = new core$1.Attribute('cellBackground', {
|
|
|
4321
4417
|
}
|
|
4322
4418
|
hsl.s *= 0.7;
|
|
4323
4419
|
const newRgba = color.hsl2Rgb(hsl);
|
|
4324
|
-
node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a})`);
|
|
4420
|
+
node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a || 1})`);
|
|
4325
4421
|
}
|
|
4326
4422
|
node.styles.set('backgroundColor', formatValue);
|
|
4327
4423
|
}
|
|
4328
4424
|
});
|
|
4329
4425
|
const cellBackgroundAttrLoader = {
|
|
4330
4426
|
match(element) {
|
|
4331
|
-
return element
|
|
4427
|
+
return (element.tagName === 'TD' || element.tagName === 'TH') && !!element.style.backgroundColor;
|
|
4332
4428
|
},
|
|
4333
4429
|
read(element) {
|
|
4334
4430
|
return {
|
|
@@ -4692,78 +4788,6 @@ const katexComponentLoader = {
|
|
|
4692
4788
|
}
|
|
4693
4789
|
};
|
|
4694
4790
|
|
|
4695
|
-
function createTimelineItem(textbus, theme) {
|
|
4696
|
-
const slot = new core$1.Slot([
|
|
4697
|
-
core$1.ContentType.BlockComponent,
|
|
4698
|
-
]);
|
|
4699
|
-
const title = new ParagraphComponent(textbus);
|
|
4700
|
-
title.state.slot.insert('时间主题', [
|
|
4701
|
-
[fontSizeFormatter, '18px'],
|
|
4702
|
-
[boldFormatter, true]
|
|
4703
|
-
]);
|
|
4704
|
-
title.state.slot.insert(' 2020-02-02', [
|
|
4705
|
-
[fontSizeFormatter, '15px'],
|
|
4706
|
-
[colorFormatter, '#777']
|
|
4707
|
-
]);
|
|
4708
|
-
const desc = new ParagraphComponent(textbus);
|
|
4709
|
-
desc.state.slot.insert('描述信息...');
|
|
4710
|
-
slot.insert(title);
|
|
4711
|
-
slot.insert(desc);
|
|
4712
|
-
return { theme, slot };
|
|
4713
|
-
}
|
|
4714
|
-
class TimelineComponent extends core$1.Component {
|
|
4715
|
-
static fromJSON(textbus, json) {
|
|
4716
|
-
const registry = textbus.get(core$1.Registry);
|
|
4717
|
-
return new TimelineComponent(textbus, {
|
|
4718
|
-
items: json.items.map(i => {
|
|
4719
|
-
return {
|
|
4720
|
-
theme: i.theme,
|
|
4721
|
-
slot: registry.createSlot(i.slot)
|
|
4722
|
-
};
|
|
4723
|
-
})
|
|
4724
|
-
});
|
|
4725
|
-
}
|
|
4726
|
-
getSlots() {
|
|
4727
|
-
return this.state.items.map(i => i.slot);
|
|
4728
|
-
}
|
|
4729
|
-
}
|
|
4730
|
-
TimelineComponent.componentName = 'TimelineComponent';
|
|
4731
|
-
TimelineComponent.type = core$1.ContentType.BlockComponent;
|
|
4732
|
-
|
|
4733
|
-
function createStepItem(textbus) {
|
|
4734
|
-
const slot = new core$1.Slot([
|
|
4735
|
-
core$1.ContentType.BlockComponent
|
|
4736
|
-
]);
|
|
4737
|
-
const title = new ParagraphComponent(textbus);
|
|
4738
|
-
title.state.slot.insert('标题', [
|
|
4739
|
-
[fontSizeFormatter, '18px'],
|
|
4740
|
-
[boldFormatter, true]
|
|
4741
|
-
]);
|
|
4742
|
-
const content = new ParagraphComponent(textbus);
|
|
4743
|
-
content.state.slot.insert('描述信息...');
|
|
4744
|
-
slot.insert(title);
|
|
4745
|
-
slot.insert(content);
|
|
4746
|
-
return { slot };
|
|
4747
|
-
}
|
|
4748
|
-
class StepComponent extends core$1.Component {
|
|
4749
|
-
static fromJSON(textbus, json) {
|
|
4750
|
-
const registry = textbus.get(core$1.Registry);
|
|
4751
|
-
return new StepComponent(textbus, {
|
|
4752
|
-
step: json.step,
|
|
4753
|
-
items: json.items.map(i => {
|
|
4754
|
-
return {
|
|
4755
|
-
slot: registry.createSlot(i.slot)
|
|
4756
|
-
};
|
|
4757
|
-
})
|
|
4758
|
-
});
|
|
4759
|
-
}
|
|
4760
|
-
getSlots() {
|
|
4761
|
-
return this.state.items.map(i => i.slot);
|
|
4762
|
-
}
|
|
4763
|
-
}
|
|
4764
|
-
StepComponent.componentName = 'StepComponent';
|
|
4765
|
-
StepComponent.type = core$1.ContentType.BlockComponent;
|
|
4766
|
-
|
|
4767
4791
|
function InsertTool(props) {
|
|
4768
4792
|
const commander = core.inject(core$1.Commander);
|
|
4769
4793
|
const selection = core.inject(core$1.Selection);
|
|
@@ -6424,7 +6448,9 @@ const TableComponentView = core.withAnnotation({
|
|
|
6424
6448
|
], children: [jsxRuntime.jsx("colgroup", { children: state.columnsConfig.map(w => {
|
|
6425
6449
|
return jsxRuntime.jsx("col", { style: { width: w + 'px', minWidth: w + 'px' } });
|
|
6426
6450
|
}) }), jsxRuntime.jsx("tbody", { children: normalizedData.map((row) => {
|
|
6427
|
-
return (jsxRuntime.jsx("tr", { children: row.cells.
|
|
6451
|
+
return (jsxRuntime.jsx("tr", { children: row.cells.filter(i => {
|
|
6452
|
+
return i.visible;
|
|
6453
|
+
}).map(cell => {
|
|
6428
6454
|
return adapter.slotRender(cell.raw.slot, children => {
|
|
6429
6455
|
return core$1.createVNode('td', {
|
|
6430
6456
|
key: cell.raw.id,
|
|
@@ -6491,6 +6517,9 @@ const tableComponentLoader = {
|
|
|
6491
6517
|
core$1.ContentType.Text
|
|
6492
6518
|
]), cell).toDelta();
|
|
6493
6519
|
const results = deltaToBlock(delta, textbus);
|
|
6520
|
+
delta.attributes.forEach((value, key) => {
|
|
6521
|
+
slot.setAttribute(key, value);
|
|
6522
|
+
});
|
|
6494
6523
|
results.forEach(i => {
|
|
6495
6524
|
slot.insert(i);
|
|
6496
6525
|
});
|
|
@@ -6519,6 +6548,9 @@ const tableComponentLoader = {
|
|
|
6519
6548
|
core$1.ContentType.Text
|
|
6520
6549
|
]), cell).toDelta();
|
|
6521
6550
|
const results = deltaToBlock(delta, textbus);
|
|
6551
|
+
delta.attributes.forEach((value, key) => {
|
|
6552
|
+
slot.setAttribute(key, value);
|
|
6553
|
+
});
|
|
6522
6554
|
results.forEach(i => {
|
|
6523
6555
|
slot.insert(i);
|
|
6524
6556
|
});
|
|
@@ -12,4 +12,5 @@ export declare class StepComponent extends Component<StepComponentState> {
|
|
|
12
12
|
static type: ContentType;
|
|
13
13
|
static fromJSON(textbus: Textbus, json: ComponentStateLiteral<StepComponentState>): StepComponent;
|
|
14
14
|
getSlots(): Slot[];
|
|
15
|
+
removeSlot(slot: Slot): boolean;
|
|
15
16
|
}
|
|
@@ -12,4 +12,5 @@ export declare class TimelineComponent extends Component<TimelineComponentState>
|
|
|
12
12
|
static type: ContentType;
|
|
13
13
|
static fromJSON(textbus: Textbus, json: ComponentStateLiteral<TimelineComponentState>): TimelineComponent;
|
|
14
14
|
getSlots(): Slot[];
|
|
15
|
+
removeSlot(slot: Slot): boolean;
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textbus/xnote",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A high-performance rich text editor that supports multiplayer online collaboration.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tanbo/color": "^0.1.1",
|
|
30
|
-
"@textbus/adapter-viewfly": "^4.2.
|
|
31
|
-
"@textbus/collaborate": "^4.2.
|
|
32
|
-
"@textbus/core": "^4.2.
|
|
33
|
-
"@textbus/platform-browser": "^4.2.
|
|
30
|
+
"@textbus/adapter-viewfly": "^4.2.2",
|
|
31
|
+
"@textbus/collaborate": "^4.2.1",
|
|
32
|
+
"@textbus/core": "^4.2.1",
|
|
33
|
+
"@textbus/platform-browser": "^4.2.2",
|
|
34
34
|
"@viewfly/core": "^1.0.5",
|
|
35
35
|
"@viewfly/hooks": "^1.0.5",
|
|
36
36
|
"@viewfly/platform-browser": "^1.0.6",
|