@textbus/xnote 0.3.2 → 0.3.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/bundles/index.esm.js +787 -223
- package/bundles/index.js +785 -221
- package/bundles/textbus/components/SlotRender.d.ts +2 -3
- package/index.tsx +64 -36
- package/package.json +10 -10
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
|
-
import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, getCurrentInstance, createRef, InjectionToken, withAnnotation, onUpdated, onMounted, ReflectiveInjector, createDynamicRef, jsx as jsx$1, viewfly, Fragment as Fragment$1, Context, watch } from '@viewfly/core';
|
|
4
|
-
import { Subject, fromEvent, Selection, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType,
|
|
3
|
+
import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, getCurrentInstance, createRef, InjectionToken, withAnnotation, onUpdated, onMounted, onPropsChanged, ReflectiveInjector, createDynamicRef, jsx as jsx$1, viewfly, Fragment as Fragment$1, Context, watch } from '@viewfly/core';
|
|
4
|
+
import { Subject, fromEvent, Selection, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType, createVNode, merge, Slot, Component, Registry, Query, QueryStateType, Formatter, BehaviorSubject, onSlotApplyFormat, onSlotSetAttribute, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, onFocusIn, onFocusOut, onDestroy, onGetRanges, onParentSlotUpdated, Textbus, History, RootComponentRef, filter, map, distinctUntilChanged, sampleTime, debounceTime, delay, tap, 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, BrowserModule, SelectionBridge, VIEW_DOCUMENT, CollaborateSelectionAwarenessDelegate, isMobileBrowser, CollaborateCursor, Parser } from '@textbus/platform-browser';
|
|
7
7
|
import { createPortal, createApp, DomRenderer, HTMLRenderer, OutputTranslator } from '@viewfly/platform-browser';
|
|
@@ -61,7 +61,18 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
61
61
|
|
|
62
62
|
let DropdownService = class DropdownService {
|
|
63
63
|
constructor() {
|
|
64
|
-
this
|
|
64
|
+
Object.defineProperty(this, "onSiblingOpen", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(this, "siblingOpenEvent", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: new Subject()
|
|
75
|
+
});
|
|
65
76
|
this.onSiblingOpen = this.siblingOpenEvent.asObservable();
|
|
66
77
|
}
|
|
67
78
|
notify(id) {
|
|
@@ -79,14 +90,60 @@ var DropdownContextService_1;
|
|
|
79
90
|
let i = 0;
|
|
80
91
|
let DropdownContextService = DropdownContextService_1 = class DropdownContextService {
|
|
81
92
|
constructor(dropdownService, injector) {
|
|
82
|
-
this
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this
|
|
89
|
-
|
|
93
|
+
Object.defineProperty(this, "dropdownService", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
configurable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: dropdownService
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(this, "injector", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true,
|
|
103
|
+
value: injector
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(this, "id", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
value: i
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(this, "isOpen", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
writable: true,
|
|
115
|
+
value: false
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(this, "onOpenStateChange", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true,
|
|
120
|
+
writable: true,
|
|
121
|
+
value: void 0
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(this, "canHide", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
writable: true,
|
|
127
|
+
value: true
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(this, "openStateChangeEvent", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true,
|
|
133
|
+
value: new Subject()
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(this, "timer", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true,
|
|
139
|
+
value: null
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(this, "parentDropdownContextService", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: true,
|
|
144
|
+
writable: true,
|
|
145
|
+
value: this.injector.get(DropdownContextService_1, null, InjectFlags.SkipSelf)
|
|
146
|
+
});
|
|
90
147
|
this.onOpenStateChange = this.openStateChangeEvent.asObservable();
|
|
91
148
|
dropdownService.onSiblingOpen.subscribe(id => {
|
|
92
149
|
if (id === this.id) {
|
|
@@ -258,14 +315,54 @@ class Picker {
|
|
|
258
315
|
return this.empty ? null : this._hsv;
|
|
259
316
|
}
|
|
260
317
|
constructor(onChange, value) {
|
|
261
|
-
this
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this
|
|
268
|
-
|
|
318
|
+
Object.defineProperty(this, "onChange", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
configurable: true,
|
|
321
|
+
writable: true,
|
|
322
|
+
value: onChange
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(this, "_hex", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
configurable: true,
|
|
327
|
+
writable: true,
|
|
328
|
+
value: ''
|
|
329
|
+
});
|
|
330
|
+
Object.defineProperty(this, "_hsl", {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
configurable: true,
|
|
333
|
+
writable: true,
|
|
334
|
+
value: null
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(this, "_rgb", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
configurable: true,
|
|
339
|
+
writable: true,
|
|
340
|
+
value: null
|
|
341
|
+
});
|
|
342
|
+
Object.defineProperty(this, "_hsv", {
|
|
343
|
+
enumerable: true,
|
|
344
|
+
configurable: true,
|
|
345
|
+
writable: true,
|
|
346
|
+
value: null
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(this, "_rgba", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
configurable: true,
|
|
351
|
+
writable: true,
|
|
352
|
+
value: null
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(this, "empty", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true,
|
|
358
|
+
value: false
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(this, "resetAlpha", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
configurable: true,
|
|
363
|
+
writable: true,
|
|
364
|
+
value: true
|
|
365
|
+
});
|
|
269
366
|
this.hex = value || '#f00';
|
|
270
367
|
}
|
|
271
368
|
}
|
|
@@ -940,7 +1037,12 @@ var scopedId$e = "vf-2a8a65";
|
|
|
940
1037
|
|
|
941
1038
|
let RefreshService = class RefreshService {
|
|
942
1039
|
constructor() {
|
|
943
|
-
this
|
|
1040
|
+
Object.defineProperty(this, "onRefresh", {
|
|
1041
|
+
enumerable: true,
|
|
1042
|
+
configurable: true,
|
|
1043
|
+
writable: true,
|
|
1044
|
+
value: new Subject()
|
|
1045
|
+
});
|
|
944
1046
|
}
|
|
945
1047
|
};
|
|
946
1048
|
RefreshService = __decorate([
|
|
@@ -1085,9 +1187,18 @@ function SlotRender(props) {
|
|
|
1085
1187
|
const adapter = inject(DomAdapter);
|
|
1086
1188
|
const instance = getCurrentInstance();
|
|
1087
1189
|
const slot = props.slot;
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1190
|
+
function listen(slot) {
|
|
1191
|
+
return merge(slot.__changeMarker__.onChange, slot.__changeMarker__.onForceChange).subscribe(() => {
|
|
1192
|
+
if (props.slot.__changeMarker__.dirty) {
|
|
1193
|
+
instance.markAsDirtied();
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
let sub = listen(slot);
|
|
1198
|
+
onPropsChanged((currentProps, oldProps) => {
|
|
1199
|
+
if (oldProps.slot !== currentProps.slot) {
|
|
1200
|
+
sub.unsubscribe();
|
|
1201
|
+
sub = listen(currentProps.slot);
|
|
1091
1202
|
}
|
|
1092
1203
|
});
|
|
1093
1204
|
onUnmounted(() => {
|
|
@@ -1122,31 +1233,46 @@ class BlockquoteComponent extends Component {
|
|
|
1122
1233
|
useBlockContent(this.state.slot);
|
|
1123
1234
|
}
|
|
1124
1235
|
}
|
|
1125
|
-
BlockquoteComponent
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1236
|
+
Object.defineProperty(BlockquoteComponent, "type", {
|
|
1237
|
+
enumerable: true,
|
|
1238
|
+
configurable: true,
|
|
1239
|
+
writable: true,
|
|
1240
|
+
value: ContentType.BlockComponent
|
|
1241
|
+
});
|
|
1242
|
+
Object.defineProperty(BlockquoteComponent, "componentName", {
|
|
1243
|
+
enumerable: true,
|
|
1244
|
+
configurable: true,
|
|
1245
|
+
writable: true,
|
|
1246
|
+
value: 'BlockquoteComponent'
|
|
1247
|
+
});
|
|
1248
|
+
Object.defineProperty(BlockquoteComponent, "zenCoding", {
|
|
1249
|
+
enumerable: true,
|
|
1250
|
+
configurable: true,
|
|
1251
|
+
writable: true,
|
|
1252
|
+
value: {
|
|
1253
|
+
key: ' ',
|
|
1254
|
+
match(content, textbus) {
|
|
1255
|
+
const selection = textbus.get(Selection);
|
|
1256
|
+
if (selection.commonAncestorComponent instanceof ParagraphComponent) {
|
|
1257
|
+
return /^>$/.test(content);
|
|
1258
|
+
}
|
|
1259
|
+
return false;
|
|
1260
|
+
},
|
|
1261
|
+
createState(_, textbus) {
|
|
1262
|
+
const selection = textbus.get(Selection);
|
|
1263
|
+
const commonAncestorSlot = selection.commonAncestorSlot;
|
|
1264
|
+
const slot = new Slot([
|
|
1265
|
+
ContentType.BlockComponent
|
|
1266
|
+
]);
|
|
1267
|
+
if (commonAncestorSlot === null || commonAncestorSlot === void 0 ? void 0 : commonAncestorSlot.hasAttribute(textIndentAttr)) {
|
|
1268
|
+
slot.setAttribute(textIndentAttr, commonAncestorSlot.getAttribute(textIndentAttr));
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
slot
|
|
1272
|
+
};
|
|
1144
1273
|
}
|
|
1145
|
-
return {
|
|
1146
|
-
slot
|
|
1147
|
-
};
|
|
1148
1274
|
}
|
|
1149
|
-
};
|
|
1275
|
+
});
|
|
1150
1276
|
function toBlockquote(textbus) {
|
|
1151
1277
|
const query = textbus.get(Query);
|
|
1152
1278
|
const commander = textbus.get(Commander);
|
|
@@ -1248,9 +1374,24 @@ class HighlightBoxComponent extends Component {
|
|
|
1248
1374
|
useBlockContent(this.state.slot);
|
|
1249
1375
|
}
|
|
1250
1376
|
}
|
|
1251
|
-
HighlightBoxComponent
|
|
1252
|
-
|
|
1253
|
-
|
|
1377
|
+
Object.defineProperty(HighlightBoxComponent, "defaultTypes", {
|
|
1378
|
+
enumerable: true,
|
|
1379
|
+
configurable: true,
|
|
1380
|
+
writable: true,
|
|
1381
|
+
value: ['❤️', '💡', '📌', '✅', '❎', '👍', '🎉', '🚫', '❗']
|
|
1382
|
+
});
|
|
1383
|
+
Object.defineProperty(HighlightBoxComponent, "componentName", {
|
|
1384
|
+
enumerable: true,
|
|
1385
|
+
configurable: true,
|
|
1386
|
+
writable: true,
|
|
1387
|
+
value: 'HighlightBoxComponent'
|
|
1388
|
+
});
|
|
1389
|
+
Object.defineProperty(HighlightBoxComponent, "type", {
|
|
1390
|
+
enumerable: true,
|
|
1391
|
+
configurable: true,
|
|
1392
|
+
writable: true,
|
|
1393
|
+
value: ContentType.BlockComponent
|
|
1394
|
+
});
|
|
1254
1395
|
function HighlightBoxView(props) {
|
|
1255
1396
|
const readonly = useReadonly();
|
|
1256
1397
|
const output = useOutput();
|
|
@@ -1431,8 +1572,18 @@ class TimelineComponent extends Component {
|
|
|
1431
1572
|
return false;
|
|
1432
1573
|
}
|
|
1433
1574
|
}
|
|
1434
|
-
TimelineComponent
|
|
1435
|
-
|
|
1575
|
+
Object.defineProperty(TimelineComponent, "componentName", {
|
|
1576
|
+
enumerable: true,
|
|
1577
|
+
configurable: true,
|
|
1578
|
+
writable: true,
|
|
1579
|
+
value: 'TimelineComponent'
|
|
1580
|
+
});
|
|
1581
|
+
Object.defineProperty(TimelineComponent, "type", {
|
|
1582
|
+
enumerable: true,
|
|
1583
|
+
configurable: true,
|
|
1584
|
+
writable: true,
|
|
1585
|
+
value: ContentType.BlockComponent
|
|
1586
|
+
});
|
|
1436
1587
|
|
|
1437
1588
|
function createStepItem(textbus) {
|
|
1438
1589
|
const slot = new Slot([
|
|
@@ -1476,8 +1627,18 @@ class StepComponent extends Component {
|
|
|
1476
1627
|
return false;
|
|
1477
1628
|
}
|
|
1478
1629
|
}
|
|
1479
|
-
StepComponent
|
|
1480
|
-
|
|
1630
|
+
Object.defineProperty(StepComponent, "componentName", {
|
|
1631
|
+
enumerable: true,
|
|
1632
|
+
configurable: true,
|
|
1633
|
+
writable: true,
|
|
1634
|
+
value: 'StepComponent'
|
|
1635
|
+
});
|
|
1636
|
+
Object.defineProperty(StepComponent, "type", {
|
|
1637
|
+
enumerable: true,
|
|
1638
|
+
configurable: true,
|
|
1639
|
+
writable: true,
|
|
1640
|
+
value: ContentType.BlockComponent
|
|
1641
|
+
});
|
|
1481
1642
|
|
|
1482
1643
|
class ParagraphComponent extends Component {
|
|
1483
1644
|
static fromJSON(textbus, json) {
|
|
@@ -1523,8 +1684,18 @@ class ParagraphComponent extends Component {
|
|
|
1523
1684
|
});
|
|
1524
1685
|
}
|
|
1525
1686
|
}
|
|
1526
|
-
ParagraphComponent
|
|
1527
|
-
|
|
1687
|
+
Object.defineProperty(ParagraphComponent, "componentName", {
|
|
1688
|
+
enumerable: true,
|
|
1689
|
+
configurable: true,
|
|
1690
|
+
writable: true,
|
|
1691
|
+
value: 'ParagraphComponent'
|
|
1692
|
+
});
|
|
1693
|
+
Object.defineProperty(ParagraphComponent, "type", {
|
|
1694
|
+
enumerable: true,
|
|
1695
|
+
configurable: true,
|
|
1696
|
+
writable: true,
|
|
1697
|
+
value: ContentType.BlockComponent
|
|
1698
|
+
});
|
|
1528
1699
|
function ParagraphView(props) {
|
|
1529
1700
|
const readonly = useReadonly();
|
|
1530
1701
|
const output = useOutput();
|
|
@@ -1708,27 +1879,42 @@ function createCodeSlot() {
|
|
|
1708
1879
|
class SourceCodeComponent extends Component {
|
|
1709
1880
|
constructor() {
|
|
1710
1881
|
super(...arguments);
|
|
1711
|
-
this
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1882
|
+
Object.defineProperty(this, "focus", {
|
|
1883
|
+
enumerable: true,
|
|
1884
|
+
configurable: true,
|
|
1885
|
+
writable: true,
|
|
1886
|
+
value: new BehaviorSubject(false)
|
|
1887
|
+
});
|
|
1888
|
+
Object.defineProperty(this, "cancelEmphasize", {
|
|
1889
|
+
enumerable: true,
|
|
1890
|
+
configurable: true,
|
|
1891
|
+
writable: true,
|
|
1892
|
+
value: () => {
|
|
1893
|
+
const selection = this.textbus.get(Selection);
|
|
1894
|
+
const slots = this.state.slots;
|
|
1895
|
+
const { startSlot, endSlot } = selection;
|
|
1896
|
+
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
1897
|
+
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
1898
|
+
for (; startIndex < endIndex; startIndex++) {
|
|
1899
|
+
slots[startIndex].emphasize = false;
|
|
1900
|
+
}
|
|
1720
1901
|
}
|
|
1721
|
-
};
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1902
|
+
});
|
|
1903
|
+
Object.defineProperty(this, "emphasize", {
|
|
1904
|
+
enumerable: true,
|
|
1905
|
+
configurable: true,
|
|
1906
|
+
writable: true,
|
|
1907
|
+
value: () => {
|
|
1908
|
+
const selection = this.textbus.get(Selection);
|
|
1909
|
+
const slots = this.state.slots;
|
|
1910
|
+
const { startSlot, endSlot } = selection;
|
|
1911
|
+
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
1912
|
+
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
1913
|
+
for (; startIndex < endIndex; startIndex++) {
|
|
1914
|
+
slots[startIndex].emphasize = true;
|
|
1915
|
+
}
|
|
1730
1916
|
}
|
|
1731
|
-
};
|
|
1917
|
+
});
|
|
1732
1918
|
}
|
|
1733
1919
|
static fromJSON(textbus, json) {
|
|
1734
1920
|
const registry = textbus.get(Registry);
|
|
@@ -1918,56 +2104,71 @@ class SourceCodeComponent extends Component {
|
|
|
1918
2104
|
return false;
|
|
1919
2105
|
}
|
|
1920
2106
|
}
|
|
1921
|
-
SourceCodeComponent
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2107
|
+
Object.defineProperty(SourceCodeComponent, "type", {
|
|
2108
|
+
enumerable: true,
|
|
2109
|
+
configurable: true,
|
|
2110
|
+
writable: true,
|
|
2111
|
+
value: ContentType.BlockComponent
|
|
2112
|
+
});
|
|
2113
|
+
Object.defineProperty(SourceCodeComponent, "componentName", {
|
|
2114
|
+
enumerable: true,
|
|
2115
|
+
configurable: true,
|
|
2116
|
+
writable: true,
|
|
2117
|
+
value: 'SourceCodeComponent'
|
|
2118
|
+
});
|
|
2119
|
+
Object.defineProperty(SourceCodeComponent, "zenCoding", {
|
|
2120
|
+
enumerable: true,
|
|
2121
|
+
configurable: true,
|
|
2122
|
+
writable: true,
|
|
2123
|
+
value: {
|
|
2124
|
+
key: ['Enter', ' '],
|
|
2125
|
+
match(c, textbus) {
|
|
2126
|
+
const selection = textbus.get(Selection);
|
|
2127
|
+
if (selection.commonAncestorComponent instanceof ParagraphComponent) {
|
|
2128
|
+
const matchString = languageList.map(i => i.label || i.value).concat('js', 'ts').join('|').replace(/\+/, '\\+');
|
|
2129
|
+
const reg = new RegExp(`^\`\`\`(${matchString})$`, 'i');
|
|
2130
|
+
return reg.test(c);
|
|
2131
|
+
}
|
|
2132
|
+
return false;
|
|
2133
|
+
},
|
|
2134
|
+
createState(content) {
|
|
2135
|
+
const matchString = content.replace(/`/g, '').replace(/\+/, '\\+');
|
|
2136
|
+
for (const item of languageList) {
|
|
2137
|
+
const reg = new RegExp(`^${matchString}$`, 'i');
|
|
2138
|
+
if (reg.test(item.label || item.value)) {
|
|
2139
|
+
return {
|
|
2140
|
+
lang: item.value,
|
|
2141
|
+
theme: '',
|
|
2142
|
+
lineNumber: true,
|
|
2143
|
+
slots: [createCodeSlot()]
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (/^js$/i.test(matchString)) {
|
|
1939
2148
|
return {
|
|
1940
|
-
lang:
|
|
2149
|
+
lang: 'JavaScript',
|
|
2150
|
+
theme: '',
|
|
2151
|
+
lineNumber: true,
|
|
2152
|
+
slots: [createCodeSlot()]
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
if (/^ts$/i.test(matchString)) {
|
|
2156
|
+
return {
|
|
2157
|
+
lang: 'TypeScript',
|
|
1941
2158
|
theme: '',
|
|
1942
2159
|
lineNumber: true,
|
|
1943
2160
|
slots: [createCodeSlot()]
|
|
1944
2161
|
};
|
|
1945
2162
|
}
|
|
1946
|
-
}
|
|
1947
|
-
if (/^js$/i.test(matchString)) {
|
|
1948
|
-
return {
|
|
1949
|
-
lang: 'JavaScript',
|
|
1950
|
-
theme: '',
|
|
1951
|
-
lineNumber: true,
|
|
1952
|
-
slots: [createCodeSlot()]
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
if (/^ts$/i.test(matchString)) {
|
|
1956
2163
|
return {
|
|
1957
|
-
lang: '
|
|
2164
|
+
lang: '',
|
|
1958
2165
|
theme: '',
|
|
1959
2166
|
lineNumber: true,
|
|
1960
2167
|
slots: [createCodeSlot()]
|
|
1961
2168
|
};
|
|
1962
2169
|
}
|
|
1963
|
-
return {
|
|
1964
|
-
lang: '',
|
|
1965
|
-
theme: '',
|
|
1966
|
-
lineNumber: true,
|
|
1967
|
-
slots: [createCodeSlot()]
|
|
1968
|
-
};
|
|
1969
2170
|
}
|
|
1970
|
-
};
|
|
2171
|
+
});
|
|
1971
2172
|
function SourceCodeView(props) {
|
|
1972
2173
|
const adapter = inject(DomAdapter);
|
|
1973
2174
|
const isFocus = createSignal(false);
|
|
@@ -2245,8 +2446,18 @@ class ImageComponent extends Component {
|
|
|
2245
2446
|
return [];
|
|
2246
2447
|
}
|
|
2247
2448
|
}
|
|
2248
|
-
ImageComponent
|
|
2249
|
-
|
|
2449
|
+
Object.defineProperty(ImageComponent, "type", {
|
|
2450
|
+
enumerable: true,
|
|
2451
|
+
configurable: true,
|
|
2452
|
+
writable: true,
|
|
2453
|
+
value: ContentType.InlineComponent
|
|
2454
|
+
});
|
|
2455
|
+
Object.defineProperty(ImageComponent, "componentName", {
|
|
2456
|
+
enumerable: true,
|
|
2457
|
+
configurable: true,
|
|
2458
|
+
writable: true,
|
|
2459
|
+
value: 'ImageComponent'
|
|
2460
|
+
});
|
|
2250
2461
|
function ImageView(props) {
|
|
2251
2462
|
const { name, state } = props.component;
|
|
2252
2463
|
const imageRef = createRef();
|
|
@@ -2287,8 +2498,18 @@ class VideoComponent extends Component {
|
|
|
2287
2498
|
return [];
|
|
2288
2499
|
}
|
|
2289
2500
|
}
|
|
2290
|
-
VideoComponent
|
|
2291
|
-
|
|
2501
|
+
Object.defineProperty(VideoComponent, "type", {
|
|
2502
|
+
enumerable: true,
|
|
2503
|
+
configurable: true,
|
|
2504
|
+
writable: true,
|
|
2505
|
+
value: ContentType.InlineComponent
|
|
2506
|
+
});
|
|
2507
|
+
Object.defineProperty(VideoComponent, "componentName", {
|
|
2508
|
+
enumerable: true,
|
|
2509
|
+
configurable: true,
|
|
2510
|
+
writable: true,
|
|
2511
|
+
value: 'VideoComponent'
|
|
2512
|
+
});
|
|
2292
2513
|
function VideoView(props) {
|
|
2293
2514
|
const { name, state } = props.component;
|
|
2294
2515
|
const videoRef = createRef();
|
|
@@ -2323,8 +2544,30 @@ const videoComponentLoader = {
|
|
|
2323
2544
|
|
|
2324
2545
|
let ToolService = class ToolService {
|
|
2325
2546
|
constructor(selection, controller) {
|
|
2326
|
-
this
|
|
2327
|
-
|
|
2547
|
+
Object.defineProperty(this, "selection", {
|
|
2548
|
+
enumerable: true,
|
|
2549
|
+
configurable: true,
|
|
2550
|
+
writable: true,
|
|
2551
|
+
value: selection
|
|
2552
|
+
});
|
|
2553
|
+
Object.defineProperty(this, "controller", {
|
|
2554
|
+
enumerable: true,
|
|
2555
|
+
configurable: true,
|
|
2556
|
+
writable: true,
|
|
2557
|
+
value: controller
|
|
2558
|
+
});
|
|
2559
|
+
Object.defineProperty(this, "state", {
|
|
2560
|
+
enumerable: true,
|
|
2561
|
+
configurable: true,
|
|
2562
|
+
writable: true,
|
|
2563
|
+
value: void 0
|
|
2564
|
+
});
|
|
2565
|
+
Object.defineProperty(this, "sub", {
|
|
2566
|
+
enumerable: true,
|
|
2567
|
+
configurable: true,
|
|
2568
|
+
writable: true,
|
|
2569
|
+
value: void 0
|
|
2570
|
+
});
|
|
2328
2571
|
const [state, updateState] = useProduce({
|
|
2329
2572
|
inSourceCode: false,
|
|
2330
2573
|
readonly: controller.readonly,
|
|
@@ -2471,10 +2714,30 @@ function AttrTool(props) {
|
|
|
2471
2714
|
|
|
2472
2715
|
class Rectangle {
|
|
2473
2716
|
constructor(x1, y1, x2, y2) {
|
|
2474
|
-
this
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2717
|
+
Object.defineProperty(this, "x1", {
|
|
2718
|
+
enumerable: true,
|
|
2719
|
+
configurable: true,
|
|
2720
|
+
writable: true,
|
|
2721
|
+
value: x1
|
|
2722
|
+
});
|
|
2723
|
+
Object.defineProperty(this, "y1", {
|
|
2724
|
+
enumerable: true,
|
|
2725
|
+
configurable: true,
|
|
2726
|
+
writable: true,
|
|
2727
|
+
value: y1
|
|
2728
|
+
});
|
|
2729
|
+
Object.defineProperty(this, "x2", {
|
|
2730
|
+
enumerable: true,
|
|
2731
|
+
configurable: true,
|
|
2732
|
+
writable: true,
|
|
2733
|
+
value: x2
|
|
2734
|
+
});
|
|
2735
|
+
Object.defineProperty(this, "y2", {
|
|
2736
|
+
enumerable: true,
|
|
2737
|
+
configurable: true,
|
|
2738
|
+
writable: true,
|
|
2739
|
+
value: y2
|
|
2740
|
+
});
|
|
2478
2741
|
}
|
|
2479
2742
|
intersects(other) {
|
|
2480
2743
|
return this.x1 < other.x2 && this.x2 > other.x1 && this.y1 < other.y2 && this.y2 > other.y1;
|
|
@@ -2595,12 +2858,42 @@ class TableComponent extends Component {
|
|
|
2595
2858
|
})
|
|
2596
2859
|
}) {
|
|
2597
2860
|
super(textbus, state);
|
|
2598
|
-
this
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2861
|
+
Object.defineProperty(this, "selection", {
|
|
2862
|
+
enumerable: true,
|
|
2863
|
+
configurable: true,
|
|
2864
|
+
writable: true,
|
|
2865
|
+
value: this.textbus.get(Selection)
|
|
2866
|
+
});
|
|
2867
|
+
Object.defineProperty(this, "commander", {
|
|
2868
|
+
enumerable: true,
|
|
2869
|
+
configurable: true,
|
|
2870
|
+
writable: true,
|
|
2871
|
+
value: this.textbus.get(Commander)
|
|
2872
|
+
});
|
|
2873
|
+
Object.defineProperty(this, "focus", {
|
|
2874
|
+
enumerable: true,
|
|
2875
|
+
configurable: true,
|
|
2876
|
+
writable: true,
|
|
2877
|
+
value: new Subject()
|
|
2878
|
+
});
|
|
2879
|
+
Object.defineProperty(this, "tableSelection", {
|
|
2880
|
+
enumerable: true,
|
|
2881
|
+
configurable: true,
|
|
2882
|
+
writable: true,
|
|
2883
|
+
value: createSignal(null)
|
|
2884
|
+
});
|
|
2885
|
+
Object.defineProperty(this, "ignoreSelectionChanges", {
|
|
2886
|
+
enumerable: true,
|
|
2887
|
+
configurable: true,
|
|
2888
|
+
writable: true,
|
|
2889
|
+
value: false
|
|
2890
|
+
});
|
|
2891
|
+
Object.defineProperty(this, "normalizedData", {
|
|
2892
|
+
enumerable: true,
|
|
2893
|
+
configurable: true,
|
|
2894
|
+
writable: true,
|
|
2895
|
+
value: []
|
|
2896
|
+
});
|
|
2604
2897
|
}
|
|
2605
2898
|
getSlots() {
|
|
2606
2899
|
return this.normalizedData.map(item => {
|
|
@@ -3012,8 +3305,18 @@ class TableComponent extends Component {
|
|
|
3012
3305
|
});
|
|
3013
3306
|
}
|
|
3014
3307
|
}
|
|
3015
|
-
TableComponent
|
|
3016
|
-
|
|
3308
|
+
Object.defineProperty(TableComponent, "componentName", {
|
|
3309
|
+
enumerable: true,
|
|
3310
|
+
configurable: true,
|
|
3311
|
+
writable: true,
|
|
3312
|
+
value: 'TableComponent'
|
|
3313
|
+
});
|
|
3314
|
+
Object.defineProperty(TableComponent, "type", {
|
|
3315
|
+
enumerable: true,
|
|
3316
|
+
configurable: true,
|
|
3317
|
+
writable: true,
|
|
3318
|
+
value: ContentType.BlockComponent
|
|
3319
|
+
});
|
|
3017
3320
|
|
|
3018
3321
|
const strikeThroughFormatter = new Formatter('strike', {
|
|
3019
3322
|
columned: true,
|
|
@@ -3122,34 +3425,49 @@ class TodolistComponent extends Component {
|
|
|
3122
3425
|
});
|
|
3123
3426
|
}
|
|
3124
3427
|
}
|
|
3125
|
-
TodolistComponent
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3428
|
+
Object.defineProperty(TodolistComponent, "type", {
|
|
3429
|
+
enumerable: true,
|
|
3430
|
+
configurable: true,
|
|
3431
|
+
writable: true,
|
|
3432
|
+
value: ContentType.BlockComponent
|
|
3433
|
+
});
|
|
3434
|
+
Object.defineProperty(TodolistComponent, "componentName", {
|
|
3435
|
+
enumerable: true,
|
|
3436
|
+
configurable: true,
|
|
3437
|
+
writable: true,
|
|
3438
|
+
value: 'TodoListComponent'
|
|
3439
|
+
});
|
|
3440
|
+
Object.defineProperty(TodolistComponent, "zenCoding", {
|
|
3441
|
+
enumerable: true,
|
|
3442
|
+
configurable: true,
|
|
3443
|
+
writable: true,
|
|
3444
|
+
value: {
|
|
3445
|
+
match(content, textbus) {
|
|
3446
|
+
const selection = textbus.get(Selection);
|
|
3447
|
+
if (selection.commonAncestorComponent instanceof ParagraphComponent) {
|
|
3448
|
+
return /^\[(x|\s)?\]$/.test(content);
|
|
3449
|
+
}
|
|
3450
|
+
return false;
|
|
3451
|
+
},
|
|
3452
|
+
key: ' ',
|
|
3453
|
+
createState(content, textbus) {
|
|
3454
|
+
const selection = textbus.get(Selection);
|
|
3455
|
+
const commonAncestorSlot = selection.commonAncestorSlot;
|
|
3456
|
+
const slot = new Slot([
|
|
3457
|
+
ContentType.InlineComponent,
|
|
3458
|
+
ContentType.Text
|
|
3459
|
+
]);
|
|
3460
|
+
if (commonAncestorSlot === null || commonAncestorSlot === void 0 ? void 0 : commonAncestorSlot.hasAttribute(textIndentAttr)) {
|
|
3461
|
+
slot.setAttribute(textIndentAttr, commonAncestorSlot.getAttribute(textIndentAttr));
|
|
3462
|
+
}
|
|
3463
|
+
const isChecked = content.charAt(1) === 'x';
|
|
3464
|
+
return {
|
|
3465
|
+
checked: isChecked,
|
|
3466
|
+
slot
|
|
3467
|
+
};
|
|
3145
3468
|
}
|
|
3146
|
-
const isChecked = content.charAt(1) === 'x';
|
|
3147
|
-
return {
|
|
3148
|
-
checked: isChecked,
|
|
3149
|
-
slot
|
|
3150
|
-
};
|
|
3151
3469
|
}
|
|
3152
|
-
};
|
|
3470
|
+
});
|
|
3153
3471
|
function TodolistView(props) {
|
|
3154
3472
|
const component = props.component;
|
|
3155
3473
|
const state = component.state;
|
|
@@ -3336,34 +3654,49 @@ class ListComponent extends Component {
|
|
|
3336
3654
|
});
|
|
3337
3655
|
}
|
|
3338
3656
|
}
|
|
3339
|
-
ListComponent
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3657
|
+
Object.defineProperty(ListComponent, "componentName", {
|
|
3658
|
+
enumerable: true,
|
|
3659
|
+
configurable: true,
|
|
3660
|
+
writable: true,
|
|
3661
|
+
value: 'ListComponent'
|
|
3662
|
+
});
|
|
3663
|
+
Object.defineProperty(ListComponent, "type", {
|
|
3664
|
+
enumerable: true,
|
|
3665
|
+
configurable: true,
|
|
3666
|
+
writable: true,
|
|
3667
|
+
value: ContentType.BlockComponent
|
|
3668
|
+
});
|
|
3669
|
+
Object.defineProperty(ListComponent, "zenCoding", {
|
|
3670
|
+
enumerable: true,
|
|
3671
|
+
configurable: true,
|
|
3672
|
+
writable: true,
|
|
3673
|
+
value: {
|
|
3674
|
+
key: ' ',
|
|
3675
|
+
match(content, textbus) {
|
|
3676
|
+
const selection = textbus.get(Selection);
|
|
3677
|
+
if (selection.commonAncestorComponent instanceof ParagraphComponent) {
|
|
3678
|
+
return /^([1-9]\.|[+*-])$/.test(content);
|
|
3679
|
+
}
|
|
3680
|
+
return false;
|
|
3681
|
+
},
|
|
3682
|
+
createState(content, textbus) {
|
|
3683
|
+
const selection = textbus.get(Selection);
|
|
3684
|
+
const commonAncestorSlot = selection.commonAncestorSlot;
|
|
3685
|
+
const slot = new Slot([
|
|
3686
|
+
ContentType.InlineComponent,
|
|
3687
|
+
ContentType.Text
|
|
3688
|
+
]);
|
|
3689
|
+
if (commonAncestorSlot === null || commonAncestorSlot === void 0 ? void 0 : commonAncestorSlot.hasAttribute(textIndentAttr)) {
|
|
3690
|
+
slot.setAttribute(textIndentAttr, commonAncestorSlot.getAttribute(textIndentAttr));
|
|
3691
|
+
}
|
|
3692
|
+
return {
|
|
3693
|
+
type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
|
|
3694
|
+
reorder: true,
|
|
3695
|
+
slot
|
|
3696
|
+
};
|
|
3359
3697
|
}
|
|
3360
|
-
return {
|
|
3361
|
-
type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
|
|
3362
|
-
reorder: true,
|
|
3363
|
-
slot
|
|
3364
|
-
};
|
|
3365
3698
|
}
|
|
3366
|
-
};
|
|
3699
|
+
});
|
|
3367
3700
|
const step = 26;
|
|
3368
3701
|
const chars = Array.from({ length: step }).map((_, index) => String.fromCharCode(96 + index + 1));
|
|
3369
3702
|
function numberToLetter(num) {
|
|
@@ -4342,7 +4675,18 @@ class KatexEditor extends Textbus {
|
|
|
4342
4675
|
],
|
|
4343
4676
|
imports: [browserModule]
|
|
4344
4677
|
});
|
|
4345
|
-
this
|
|
4678
|
+
Object.defineProperty(this, "host", {
|
|
4679
|
+
enumerable: true,
|
|
4680
|
+
configurable: true,
|
|
4681
|
+
writable: true,
|
|
4682
|
+
value: void 0
|
|
4683
|
+
});
|
|
4684
|
+
Object.defineProperty(this, "onValueChange", {
|
|
4685
|
+
enumerable: true,
|
|
4686
|
+
configurable: true,
|
|
4687
|
+
writable: true,
|
|
4688
|
+
value: new Subject()
|
|
4689
|
+
});
|
|
4346
4690
|
}
|
|
4347
4691
|
mount(host, code) {
|
|
4348
4692
|
this.host = host;
|
|
@@ -4389,8 +4733,18 @@ class KatexComponent extends Component {
|
|
|
4389
4733
|
return [];
|
|
4390
4734
|
}
|
|
4391
4735
|
}
|
|
4392
|
-
KatexComponent
|
|
4393
|
-
|
|
4736
|
+
Object.defineProperty(KatexComponent, "componentName", {
|
|
4737
|
+
enumerable: true,
|
|
4738
|
+
configurable: true,
|
|
4739
|
+
writable: true,
|
|
4740
|
+
value: 'KatexComponent'
|
|
4741
|
+
});
|
|
4742
|
+
Object.defineProperty(KatexComponent, "type", {
|
|
4743
|
+
enumerable: true,
|
|
4744
|
+
configurable: true,
|
|
4745
|
+
writable: true,
|
|
4746
|
+
value: ContentType.InlineComponent
|
|
4747
|
+
});
|
|
4394
4748
|
function domToVDom(el) {
|
|
4395
4749
|
const attrs = {};
|
|
4396
4750
|
el.getAttributeNames().forEach(key => {
|
|
@@ -4679,9 +5033,24 @@ var scopedId$c = "vf-e74208";
|
|
|
4679
5033
|
|
|
4680
5034
|
let EditorService = class EditorService {
|
|
4681
5035
|
constructor() {
|
|
4682
|
-
this
|
|
4683
|
-
|
|
4684
|
-
|
|
5036
|
+
Object.defineProperty(this, "hideInlineToolbar", {
|
|
5037
|
+
enumerable: true,
|
|
5038
|
+
configurable: true,
|
|
5039
|
+
writable: true,
|
|
5040
|
+
value: false
|
|
5041
|
+
});
|
|
5042
|
+
Object.defineProperty(this, "canShowLeftToolbar", {
|
|
5043
|
+
enumerable: true,
|
|
5044
|
+
configurable: true,
|
|
5045
|
+
writable: true,
|
|
5046
|
+
value: true
|
|
5047
|
+
});
|
|
5048
|
+
Object.defineProperty(this, "onLeftToolbarCanVisibleChange", {
|
|
5049
|
+
enumerable: true,
|
|
5050
|
+
configurable: true,
|
|
5051
|
+
writable: true,
|
|
5052
|
+
value: new Subject()
|
|
5053
|
+
});
|
|
4685
5054
|
}
|
|
4686
5055
|
changeLeftToolbarVisible(b) {
|
|
4687
5056
|
this.canShowLeftToolbar = b;
|
|
@@ -5556,7 +5925,12 @@ const LeftToolbar = withAnnotation({
|
|
|
5556
5925
|
|
|
5557
5926
|
class LeftToolbarPlugin {
|
|
5558
5927
|
constructor() {
|
|
5559
|
-
this
|
|
5928
|
+
Object.defineProperty(this, "app", {
|
|
5929
|
+
enumerable: true,
|
|
5930
|
+
configurable: true,
|
|
5931
|
+
writable: true,
|
|
5932
|
+
value: null
|
|
5933
|
+
});
|
|
5560
5934
|
}
|
|
5561
5935
|
setup(injector) {
|
|
5562
5936
|
const App = function () {
|
|
@@ -5832,8 +6206,18 @@ const InlineToolbar = withAnnotation({
|
|
|
5832
6206
|
|
|
5833
6207
|
class InlineToolbarPlugin {
|
|
5834
6208
|
constructor(config = {}) {
|
|
5835
|
-
this
|
|
5836
|
-
|
|
6209
|
+
Object.defineProperty(this, "config", {
|
|
6210
|
+
enumerable: true,
|
|
6211
|
+
configurable: true,
|
|
6212
|
+
writable: true,
|
|
6213
|
+
value: config
|
|
6214
|
+
});
|
|
6215
|
+
Object.defineProperty(this, "app", {
|
|
6216
|
+
enumerable: true,
|
|
6217
|
+
configurable: true,
|
|
6218
|
+
writable: true,
|
|
6219
|
+
value: null
|
|
6220
|
+
});
|
|
5837
6221
|
}
|
|
5838
6222
|
setup(injector) {
|
|
5839
6223
|
const App = () => {
|
|
@@ -5880,9 +6264,24 @@ const StaticToolbar = withAnnotation({
|
|
|
5880
6264
|
|
|
5881
6265
|
class StaticToolbarPlugin {
|
|
5882
6266
|
constructor(options) {
|
|
5883
|
-
this
|
|
5884
|
-
|
|
5885
|
-
|
|
6267
|
+
Object.defineProperty(this, "options", {
|
|
6268
|
+
enumerable: true,
|
|
6269
|
+
configurable: true,
|
|
6270
|
+
writable: true,
|
|
6271
|
+
value: options
|
|
6272
|
+
});
|
|
6273
|
+
Object.defineProperty(this, "app", {
|
|
6274
|
+
enumerable: true,
|
|
6275
|
+
configurable: true,
|
|
6276
|
+
writable: true,
|
|
6277
|
+
value: null
|
|
6278
|
+
});
|
|
6279
|
+
Object.defineProperty(this, "container", {
|
|
6280
|
+
enumerable: true,
|
|
6281
|
+
configurable: true,
|
|
6282
|
+
writable: true,
|
|
6283
|
+
value: null
|
|
6284
|
+
});
|
|
5886
6285
|
}
|
|
5887
6286
|
setup(injector) {
|
|
5888
6287
|
const container = document.createElement('div');
|
|
@@ -5962,9 +6361,24 @@ const SuspensionToolbar = withAnnotation({
|
|
|
5962
6361
|
|
|
5963
6362
|
class SuspensionToolbarPlugin {
|
|
5964
6363
|
constructor(options = {}) {
|
|
5965
|
-
this
|
|
5966
|
-
|
|
5967
|
-
|
|
6364
|
+
Object.defineProperty(this, "options", {
|
|
6365
|
+
enumerable: true,
|
|
6366
|
+
configurable: true,
|
|
6367
|
+
writable: true,
|
|
6368
|
+
value: options
|
|
6369
|
+
});
|
|
6370
|
+
Object.defineProperty(this, "app", {
|
|
6371
|
+
enumerable: true,
|
|
6372
|
+
configurable: true,
|
|
6373
|
+
writable: true,
|
|
6374
|
+
value: null
|
|
6375
|
+
});
|
|
6376
|
+
Object.defineProperty(this, "container", {
|
|
6377
|
+
enumerable: true,
|
|
6378
|
+
configurable: true,
|
|
6379
|
+
writable: true,
|
|
6380
|
+
value: null
|
|
6381
|
+
});
|
|
5968
6382
|
}
|
|
5969
6383
|
setup(injector) {
|
|
5970
6384
|
const host = injector.get(VIEW_CONTAINER);
|
|
@@ -5985,10 +6399,30 @@ class SuspensionToolbarPlugin {
|
|
|
5985
6399
|
|
|
5986
6400
|
class Matcher {
|
|
5987
6401
|
constructor(target, rule) {
|
|
5988
|
-
this
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
6402
|
+
Object.defineProperty(this, "target", {
|
|
6403
|
+
enumerable: true,
|
|
6404
|
+
configurable: true,
|
|
6405
|
+
writable: true,
|
|
6406
|
+
value: target
|
|
6407
|
+
});
|
|
6408
|
+
Object.defineProperty(this, "rule", {
|
|
6409
|
+
enumerable: true,
|
|
6410
|
+
configurable: true,
|
|
6411
|
+
writable: true,
|
|
6412
|
+
value: rule
|
|
6413
|
+
});
|
|
6414
|
+
Object.defineProperty(this, "validators", {
|
|
6415
|
+
enumerable: true,
|
|
6416
|
+
configurable: true,
|
|
6417
|
+
writable: true,
|
|
6418
|
+
value: []
|
|
6419
|
+
});
|
|
6420
|
+
Object.defineProperty(this, "excludeValidators", {
|
|
6421
|
+
enumerable: true,
|
|
6422
|
+
configurable: true,
|
|
6423
|
+
writable: true,
|
|
6424
|
+
value: []
|
|
6425
|
+
});
|
|
5992
6426
|
if (rule.tags) {
|
|
5993
6427
|
this.validators.push(this.makeTagsMatcher(rule.tags));
|
|
5994
6428
|
}
|
|
@@ -6129,11 +6563,36 @@ class AtComponent extends Component {
|
|
|
6129
6563
|
state.slot = new Slot([ContentType.Text]);
|
|
6130
6564
|
}
|
|
6131
6565
|
super(textbus, state);
|
|
6132
|
-
this
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6566
|
+
Object.defineProperty(this, "focus", {
|
|
6567
|
+
enumerable: true,
|
|
6568
|
+
configurable: true,
|
|
6569
|
+
writable: true,
|
|
6570
|
+
value: new Subject()
|
|
6571
|
+
});
|
|
6572
|
+
Object.defineProperty(this, "members", {
|
|
6573
|
+
enumerable: true,
|
|
6574
|
+
configurable: true,
|
|
6575
|
+
writable: true,
|
|
6576
|
+
value: createSignal([])
|
|
6577
|
+
});
|
|
6578
|
+
Object.defineProperty(this, "selectedIndex", {
|
|
6579
|
+
enumerable: true,
|
|
6580
|
+
configurable: true,
|
|
6581
|
+
writable: true,
|
|
6582
|
+
value: createSignal(0)
|
|
6583
|
+
});
|
|
6584
|
+
Object.defineProperty(this, "selection", {
|
|
6585
|
+
enumerable: true,
|
|
6586
|
+
configurable: true,
|
|
6587
|
+
writable: true,
|
|
6588
|
+
value: this.textbus.get(Selection)
|
|
6589
|
+
});
|
|
6590
|
+
Object.defineProperty(this, "organization", {
|
|
6591
|
+
enumerable: true,
|
|
6592
|
+
configurable: true,
|
|
6593
|
+
writable: true,
|
|
6594
|
+
value: this.textbus.get(Organization)
|
|
6595
|
+
});
|
|
6137
6596
|
}
|
|
6138
6597
|
getSlots() {
|
|
6139
6598
|
if (this.state.userInfo) {
|
|
@@ -6231,8 +6690,18 @@ class AtComponent extends Component {
|
|
|
6231
6690
|
this.selection.selectComponentEnd(this);
|
|
6232
6691
|
}
|
|
6233
6692
|
}
|
|
6234
|
-
AtComponent
|
|
6235
|
-
|
|
6693
|
+
Object.defineProperty(AtComponent, "componentName", {
|
|
6694
|
+
enumerable: true,
|
|
6695
|
+
configurable: true,
|
|
6696
|
+
writable: true,
|
|
6697
|
+
value: 'AtComponent'
|
|
6698
|
+
});
|
|
6699
|
+
Object.defineProperty(AtComponent, "type", {
|
|
6700
|
+
enumerable: true,
|
|
6701
|
+
configurable: true,
|
|
6702
|
+
writable: true,
|
|
6703
|
+
value: ContentType.InlineComponent
|
|
6704
|
+
});
|
|
6236
6705
|
|
|
6237
6706
|
function AtComponentView(props) {
|
|
6238
6707
|
const dropdownRef = createRef();
|
|
@@ -6313,7 +6782,12 @@ const atComponentLoader = {
|
|
|
6313
6782
|
class RootComponent extends Component {
|
|
6314
6783
|
constructor() {
|
|
6315
6784
|
super(...arguments);
|
|
6316
|
-
this
|
|
6785
|
+
Object.defineProperty(this, "onCompositionStart", {
|
|
6786
|
+
enumerable: true,
|
|
6787
|
+
configurable: true,
|
|
6788
|
+
writable: true,
|
|
6789
|
+
value: new Subject()
|
|
6790
|
+
});
|
|
6317
6791
|
}
|
|
6318
6792
|
static fromJSON(textbus, json) {
|
|
6319
6793
|
const content = textbus.get(Registry).createSlot(json.content);
|
|
@@ -6351,8 +6825,18 @@ class RootComponent extends Component {
|
|
|
6351
6825
|
selection.setPosition(newParagraph.state.slot, 0);
|
|
6352
6826
|
}
|
|
6353
6827
|
}
|
|
6354
|
-
RootComponent
|
|
6355
|
-
|
|
6828
|
+
Object.defineProperty(RootComponent, "componentName", {
|
|
6829
|
+
enumerable: true,
|
|
6830
|
+
configurable: true,
|
|
6831
|
+
writable: true,
|
|
6832
|
+
value: 'RootComponent'
|
|
6833
|
+
});
|
|
6834
|
+
Object.defineProperty(RootComponent, "type", {
|
|
6835
|
+
enumerable: true,
|
|
6836
|
+
configurable: true,
|
|
6837
|
+
writable: true,
|
|
6838
|
+
value: ContentType.BlockComponent
|
|
6839
|
+
});
|
|
6356
6840
|
function RootView(props) {
|
|
6357
6841
|
const ref = createDynamicRef(node => {
|
|
6358
6842
|
const sub = props.component.onCompositionStart.subscribe(() => {
|
|
@@ -6405,11 +6889,26 @@ var scopedId$5 = "vf-681de2";
|
|
|
6405
6889
|
|
|
6406
6890
|
let TableService = class TableService {
|
|
6407
6891
|
constructor() {
|
|
6408
|
-
this
|
|
6409
|
-
|
|
6892
|
+
Object.defineProperty(this, "onInsertRowBefore", {
|
|
6893
|
+
enumerable: true,
|
|
6894
|
+
configurable: true,
|
|
6895
|
+
writable: true,
|
|
6896
|
+
value: new Subject()
|
|
6897
|
+
});
|
|
6898
|
+
Object.defineProperty(this, "onInsertColumnBefore", {
|
|
6899
|
+
enumerable: true,
|
|
6900
|
+
configurable: true,
|
|
6901
|
+
writable: true,
|
|
6902
|
+
value: new Subject()
|
|
6903
|
+
});
|
|
6410
6904
|
// onSelectColumns = new Subject<{ start: number, end: number } | null>()
|
|
6411
6905
|
// onSelectRows = new Subject<{ start: number, end: number } | null>()
|
|
6412
|
-
this
|
|
6906
|
+
Object.defineProperty(this, "onScroll", {
|
|
6907
|
+
enumerable: true,
|
|
6908
|
+
configurable: true,
|
|
6909
|
+
writable: true,
|
|
6910
|
+
value: new Subject()
|
|
6911
|
+
});
|
|
6413
6912
|
}
|
|
6414
6913
|
};
|
|
6415
6914
|
TableService = __decorate([
|
|
@@ -7028,7 +7527,9 @@ const TableComponentView = withAnnotation({
|
|
|
7028
7527
|
rowMapping.set(row.row, Math.random());
|
|
7029
7528
|
});
|
|
7030
7529
|
if (readonly() || output()) {
|
|
7031
|
-
return (jsx("div", { class: "xnote-table", "data-component": props.component.name, "data-layout-width": `[${state.columnsConfig.join(',')}]`, children: jsx("div", { class: "xnote-table-inner", ref: props.rootRef, children: jsx("div", { class: "xnote-table-container",
|
|
7530
|
+
return (jsx("div", { class: "xnote-table", "data-component": props.component.name, "data-layout-width": `[${state.columnsConfig.join(',')}]`, children: jsx("div", { class: "xnote-table-inner", ref: props.rootRef, children: jsx("div", { class: "xnote-table-container", style: {
|
|
7531
|
+
overflow: 'auto'
|
|
7532
|
+
}, children: jsxs("table", { class: [
|
|
7032
7533
|
'xnote-table-content',
|
|
7033
7534
|
{
|
|
7034
7535
|
'hide-selection': props.component.tableSelection()
|
|
@@ -7082,6 +7583,9 @@ const tableComponentLoader = {
|
|
|
7082
7583
|
let content = element;
|
|
7083
7584
|
if (element.tagName === 'DIV') {
|
|
7084
7585
|
content = element.querySelector('.xnote-table-content');
|
|
7586
|
+
if (!content) {
|
|
7587
|
+
return;
|
|
7588
|
+
}
|
|
7085
7589
|
}
|
|
7086
7590
|
const { tHead, tBodies, tFoot } = content;
|
|
7087
7591
|
const headers = [];
|
|
@@ -7189,8 +7693,18 @@ function findFocusCell(table, slot) {
|
|
|
7189
7693
|
let TableSelectionAwarenessDelegate = class TableSelectionAwarenessDelegate extends CollaborateSelectionAwarenessDelegate {
|
|
7190
7694
|
constructor(domAdapter, selection) {
|
|
7191
7695
|
super();
|
|
7192
|
-
this
|
|
7193
|
-
|
|
7696
|
+
Object.defineProperty(this, "domAdapter", {
|
|
7697
|
+
enumerable: true,
|
|
7698
|
+
configurable: true,
|
|
7699
|
+
writable: true,
|
|
7700
|
+
value: domAdapter
|
|
7701
|
+
});
|
|
7702
|
+
Object.defineProperty(this, "selection", {
|
|
7703
|
+
enumerable: true,
|
|
7704
|
+
configurable: true,
|
|
7705
|
+
writable: true,
|
|
7706
|
+
value: selection
|
|
7707
|
+
});
|
|
7194
7708
|
}
|
|
7195
7709
|
getRects(abstractSelection, _, data) {
|
|
7196
7710
|
const { focusSlot, anchorSlot } = abstractSelection;
|
|
@@ -7349,10 +7863,36 @@ const stepComponentLoader = {
|
|
|
7349
7863
|
class XNoteMessageBus extends MessageBus {
|
|
7350
7864
|
constructor(selection, collaborateCursor, userinfo) {
|
|
7351
7865
|
super();
|
|
7352
|
-
this
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7866
|
+
Object.defineProperty(this, "selection", {
|
|
7867
|
+
enumerable: true,
|
|
7868
|
+
configurable: true,
|
|
7869
|
+
writable: true,
|
|
7870
|
+
value: selection
|
|
7871
|
+
});
|
|
7872
|
+
Object.defineProperty(this, "collaborateCursor", {
|
|
7873
|
+
enumerable: true,
|
|
7874
|
+
configurable: true,
|
|
7875
|
+
writable: true,
|
|
7876
|
+
value: collaborateCursor
|
|
7877
|
+
});
|
|
7878
|
+
Object.defineProperty(this, "userinfo", {
|
|
7879
|
+
enumerable: true,
|
|
7880
|
+
configurable: true,
|
|
7881
|
+
writable: true,
|
|
7882
|
+
value: userinfo
|
|
7883
|
+
});
|
|
7884
|
+
Object.defineProperty(this, "onMessageChange", {
|
|
7885
|
+
enumerable: true,
|
|
7886
|
+
configurable: true,
|
|
7887
|
+
writable: true,
|
|
7888
|
+
value: void 0
|
|
7889
|
+
});
|
|
7890
|
+
Object.defineProperty(this, "messageChangeEvent", {
|
|
7891
|
+
enumerable: true,
|
|
7892
|
+
configurable: true,
|
|
7893
|
+
writable: true,
|
|
7894
|
+
value: new Subject()
|
|
7895
|
+
});
|
|
7356
7896
|
this.onMessageChange = this.messageChangeEvent.asObservable();
|
|
7357
7897
|
}
|
|
7358
7898
|
get() {
|
|
@@ -7553,8 +8093,30 @@ class Editor extends Textbus {
|
|
|
7553
8093
|
registerListShortcut(textbus);
|
|
7554
8094
|
registerBlockquoteShortcut(textbus);
|
|
7555
8095
|
} }, editorConfig));
|
|
7556
|
-
this
|
|
7557
|
-
|
|
8096
|
+
Object.defineProperty(this, "editorConfig", {
|
|
8097
|
+
enumerable: true,
|
|
8098
|
+
configurable: true,
|
|
8099
|
+
writable: true,
|
|
8100
|
+
value: editorConfig
|
|
8101
|
+
});
|
|
8102
|
+
Object.defineProperty(this, "translator", {
|
|
8103
|
+
enumerable: true,
|
|
8104
|
+
configurable: true,
|
|
8105
|
+
writable: true,
|
|
8106
|
+
value: new OutputTranslator()
|
|
8107
|
+
});
|
|
8108
|
+
Object.defineProperty(this, "host", {
|
|
8109
|
+
enumerable: true,
|
|
8110
|
+
configurable: true,
|
|
8111
|
+
writable: true,
|
|
8112
|
+
value: void 0
|
|
8113
|
+
});
|
|
8114
|
+
Object.defineProperty(this, "vDomAdapter", {
|
|
8115
|
+
enumerable: true,
|
|
8116
|
+
configurable: true,
|
|
8117
|
+
writable: true,
|
|
8118
|
+
value: void 0
|
|
8119
|
+
});
|
|
7558
8120
|
this.vDomAdapter = vDomAdapter;
|
|
7559
8121
|
}
|
|
7560
8122
|
mount(host) {
|
|
@@ -7575,7 +8137,9 @@ class Editor extends Textbus {
|
|
|
7575
8137
|
this.guardReady();
|
|
7576
8138
|
const newModel = this.createModel(content);
|
|
7577
8139
|
const rootComponent = this.get(RootComponentRef).component;
|
|
7578
|
-
|
|
8140
|
+
const slot = newModel.state.content;
|
|
8141
|
+
newModel.state.content = null;
|
|
8142
|
+
rootComponent.state.content = slot;
|
|
7579
8143
|
}
|
|
7580
8144
|
getHTML() {
|
|
7581
8145
|
return this.translator.transform(this.vDomAdapter.host);
|