@textbus/xnote 0.0.1-alpha.3 → 0.0.1-alpha.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/editor.d.ts +4 -1
- package/bundles/index.esm.js +224 -471
- package/bundles/index.js +222 -469
- package/package.json +5 -5
package/bundles/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var highlightjs = require('highlight.js');
|
|
|
11
11
|
var adapterViewfly = require('@textbus/adapter-viewfly');
|
|
12
12
|
var collaborate = require('@textbus/collaborate');
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var css$j = undefined;
|
|
15
15
|
|
|
16
16
|
/******************************************************************************
|
|
17
17
|
Copyright (c) Microsoft Corporation.
|
|
@@ -58,18 +58,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
58
58
|
|
|
59
59
|
exports.DropdownService = class DropdownService {
|
|
60
60
|
constructor() {
|
|
61
|
-
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: void 0
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "siblingOpenEvent", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: new core$1.Subject()
|
|
72
|
-
});
|
|
61
|
+
this.siblingOpenEvent = new core$1.Subject();
|
|
73
62
|
this.onSiblingOpen = this.siblingOpenEvent.asObservable();
|
|
74
63
|
}
|
|
75
64
|
notify(id) {
|
|
@@ -87,60 +76,14 @@ var DropdownContextService_1;
|
|
|
87
76
|
let i = 0;
|
|
88
77
|
exports.DropdownContextService = DropdownContextService_1 = class DropdownContextService {
|
|
89
78
|
constructor(dropdownService, injector) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
configurable: true,
|
|
99
|
-
writable: true,
|
|
100
|
-
value: injector
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(this, "id", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
configurable: true,
|
|
105
|
-
writable: true,
|
|
106
|
-
value: i
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(this, "isOpen", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
writable: true,
|
|
112
|
-
value: false
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(this, "onOpenStateChange", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true,
|
|
117
|
-
writable: true,
|
|
118
|
-
value: void 0
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(this, "canHide", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
configurable: true,
|
|
123
|
-
writable: true,
|
|
124
|
-
value: true
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(this, "openStateChangeEvent", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
configurable: true,
|
|
129
|
-
writable: true,
|
|
130
|
-
value: new core$1.Subject()
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(this, "timer", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
configurable: true,
|
|
135
|
-
writable: true,
|
|
136
|
-
value: null
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(this, "parentDropdownContextService", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
configurable: true,
|
|
141
|
-
writable: true,
|
|
142
|
-
value: this.injector.get(DropdownContextService_1, core.InjectFlags.SkipSelf, null)
|
|
143
|
-
});
|
|
79
|
+
this.dropdownService = dropdownService;
|
|
80
|
+
this.injector = injector;
|
|
81
|
+
this.id = i;
|
|
82
|
+
this.isOpen = false;
|
|
83
|
+
this.canHide = true;
|
|
84
|
+
this.openStateChangeEvent = new core$1.Subject();
|
|
85
|
+
this.timer = null;
|
|
86
|
+
this.parentDropdownContextService = this.injector.get(DropdownContextService_1, core.InjectFlags.SkipSelf, null);
|
|
144
87
|
this.onOpenStateChange = this.openStateChangeEvent.asObservable();
|
|
145
88
|
dropdownService.onSiblingOpen.subscribe(id => {
|
|
146
89
|
if (id === this.id) {
|
|
@@ -199,7 +142,7 @@ function Button(props) {
|
|
|
199
142
|
subscription.unsubscribe();
|
|
200
143
|
});
|
|
201
144
|
}
|
|
202
|
-
return scopedCss.withScopedCSS(
|
|
145
|
+
return scopedCss.withScopedCSS(css$j, () => {
|
|
203
146
|
return (jsxRuntime.jsxs("button", Object.assign({ type: "button" }, props, { class: [
|
|
204
147
|
'btn',
|
|
205
148
|
{
|
|
@@ -211,10 +154,10 @@ function Button(props) {
|
|
|
211
154
|
});
|
|
212
155
|
}
|
|
213
156
|
|
|
214
|
-
var
|
|
157
|
+
var css$i = undefined;
|
|
215
158
|
|
|
216
159
|
function ComponentToolbar(props) {
|
|
217
|
-
return scopedCss.withScopedCSS(
|
|
160
|
+
return scopedCss.withScopedCSS(css$i, () => {
|
|
218
161
|
return (jsxRuntime.jsx("div", { class: "component-toolbar", style: props.style, children: jsxRuntime.jsx("div", { class: [
|
|
219
162
|
'toolbar',
|
|
220
163
|
{
|
|
@@ -224,15 +167,15 @@ function ComponentToolbar(props) {
|
|
|
224
167
|
});
|
|
225
168
|
}
|
|
226
169
|
|
|
227
|
-
var
|
|
170
|
+
var css$h = undefined;
|
|
228
171
|
|
|
229
172
|
function Divider() {
|
|
230
|
-
return scopedCss.withScopedCSS(
|
|
173
|
+
return scopedCss.withScopedCSS(css$h, () => {
|
|
231
174
|
return jsxRuntime.jsx("div", { class: "divider" });
|
|
232
175
|
});
|
|
233
176
|
}
|
|
234
177
|
|
|
235
|
-
var
|
|
178
|
+
var style = undefined;
|
|
236
179
|
|
|
237
180
|
function DragResize(props) {
|
|
238
181
|
const isShow = core.createSignal(false);
|
|
@@ -340,16 +283,16 @@ function DragResize(props) {
|
|
|
340
283
|
unUp.unsubscribe();
|
|
341
284
|
});
|
|
342
285
|
}
|
|
343
|
-
return scopedCss.withScopedCSS(
|
|
286
|
+
return scopedCss.withScopedCSS(style, () => {
|
|
344
287
|
return (jsxRuntime.jsxs("div", { class: "drag-resize", onClick: selectComponent, children: [jsxRuntime.jsx("div", { class: "container", ref: ref, children: props.children }), jsxRuntime.jsxs("div", { class: ['resize-tool', {
|
|
345
288
|
active: isShow()
|
|
346
289
|
}], children: [jsxRuntime.jsxs("div", { class: "mask", ref: mask, children: [component.state.width, "*", component.state.height] }), jsxRuntime.jsxs("div", { class: "btn-group", ref: btnGroup, onMousedown: drag, children: [jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" })] })] })] }));
|
|
347
290
|
});
|
|
348
291
|
}
|
|
349
292
|
|
|
350
|
-
var
|
|
293
|
+
var css$g = undefined;
|
|
351
294
|
|
|
352
|
-
var
|
|
295
|
+
var css$f = undefined;
|
|
353
296
|
|
|
354
297
|
const DropdownMenuPortal = core.withAnnotation({
|
|
355
298
|
providers: [
|
|
@@ -432,7 +375,7 @@ const DropdownMenuPortal = core.withAnnotation({
|
|
|
432
375
|
dropdownContextService.canHide = true;
|
|
433
376
|
dropdownContextService.hide();
|
|
434
377
|
}
|
|
435
|
-
return platformBrowser$1.createPortal(scopedCss.withScopedCSS(
|
|
378
|
+
return platformBrowser$1.createPortal(scopedCss.withScopedCSS(css$f, () => {
|
|
436
379
|
return (jsxRuntime.jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
|
|
437
380
|
width: props.width
|
|
438
381
|
}, class: "dropdown-menu", children: jsxRuntime.jsx("div", { class: "dropdown-menu-content", children: props.children }) }));
|
|
@@ -493,7 +436,7 @@ const Dropdown = core.withAnnotation({
|
|
|
493
436
|
dropdownContextService.open();
|
|
494
437
|
}
|
|
495
438
|
},
|
|
496
|
-
$render: scopedCss.withScopedCSS(
|
|
439
|
+
$render: scopedCss.withScopedCSS(css$g, () => {
|
|
497
440
|
return (jsxRuntime.jsxs("div", { class: ['dropdown', props.class], style: props.style, ref: dropdownRef, children: [jsxRuntime.jsxs("div", { class: "dropdown-btn", ref: triggerRef, children: [jsxRuntime.jsx("div", { class: "dropdown-btn-inner", children: props.children }), jsxRuntime.jsx("div", { class: "dropdown-btn-arrow" })] }), isShow() && jsxRuntime.jsx(DropdownMenuPortal, { width: props.width, abreast: props.abreast, triggerRef: triggerRef, children: Array.isArray(props.menu) ?
|
|
498
441
|
props.menu.map(menu => {
|
|
499
442
|
return (jsxRuntime.jsx("div", { class: "dropdown-menu-item", onClick: () => {
|
|
@@ -509,7 +452,7 @@ const Dropdown = core.withAnnotation({
|
|
|
509
452
|
};
|
|
510
453
|
});
|
|
511
454
|
|
|
512
|
-
var
|
|
455
|
+
var css$e = undefined;
|
|
513
456
|
|
|
514
457
|
function MenuItem(props) {
|
|
515
458
|
const dropdownContextService = core.inject(exports.DropdownContextService, core.InjectFlags.Optional, null);
|
|
@@ -529,7 +472,7 @@ function MenuItem(props) {
|
|
|
529
472
|
}
|
|
530
473
|
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, props.value);
|
|
531
474
|
}
|
|
532
|
-
return scopedCss.withScopedCSS(
|
|
475
|
+
return scopedCss.withScopedCSS(css$e, () => {
|
|
533
476
|
return (jsxRuntime.jsxs("div", { class: ['menu-item', { disabled: props.disabled, active: props.arrow && isActive() }], onClick: click, children: [jsxRuntime.jsxs("div", { children: [props.icon && jsxRuntime.jsx("span", { class: "menu-icon", children: props.icon }), props.children] }), props.arrow ?
|
|
534
477
|
jsxRuntime.jsx("div", { class: "arrow", children: jsxRuntime.jsx("span", { class: "xnote-icon-arrow-right" }) }) :
|
|
535
478
|
jsxRuntime.jsx("div", { class: [
|
|
@@ -539,11 +482,11 @@ function MenuItem(props) {
|
|
|
539
482
|
});
|
|
540
483
|
}
|
|
541
484
|
|
|
542
|
-
var
|
|
485
|
+
var css$d = undefined;
|
|
543
486
|
|
|
544
487
|
function Popup(props) {
|
|
545
488
|
const host = core.inject(platformBrowser.VIEW_CONTAINER);
|
|
546
|
-
return platformBrowser$1.createPortal(scopedCss.withScopedCSS(
|
|
489
|
+
return platformBrowser$1.createPortal(scopedCss.withScopedCSS(css$d, () => {
|
|
547
490
|
return (jsxRuntime.jsx("div", { class: "popup", style: {
|
|
548
491
|
left: props.left + 'px',
|
|
549
492
|
top: props.top + 'px'
|
|
@@ -551,24 +494,19 @@ function Popup(props) {
|
|
|
551
494
|
}), host);
|
|
552
495
|
}
|
|
553
496
|
|
|
554
|
-
var
|
|
497
|
+
var css$c = undefined;
|
|
555
498
|
|
|
556
499
|
function ToolbarItem(props) {
|
|
557
|
-
return scopedCss.withScopedCSS(
|
|
500
|
+
return scopedCss.withScopedCSS(css$c, () => {
|
|
558
501
|
return (jsxRuntime.jsx("div", { class: "toolbar-item", children: props.children }));
|
|
559
502
|
});
|
|
560
503
|
}
|
|
561
504
|
|
|
562
|
-
var
|
|
505
|
+
var css$b = undefined;
|
|
563
506
|
|
|
564
507
|
exports.RefreshService = class RefreshService {
|
|
565
508
|
constructor() {
|
|
566
|
-
|
|
567
|
-
enumerable: true,
|
|
568
|
-
configurable: true,
|
|
569
|
-
writable: true,
|
|
570
|
-
value: new core$1.Subject()
|
|
571
|
-
});
|
|
509
|
+
this.onRefresh = new core$1.Subject();
|
|
572
510
|
}
|
|
573
511
|
};
|
|
574
512
|
exports.RefreshService = __decorate([
|
|
@@ -650,18 +588,8 @@ class ParagraphComponent extends core$1.Component {
|
|
|
650
588
|
});
|
|
651
589
|
}
|
|
652
590
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
configurable: true,
|
|
656
|
-
writable: true,
|
|
657
|
-
value: 'ParagraphComponent'
|
|
658
|
-
});
|
|
659
|
-
Object.defineProperty(ParagraphComponent, "type", {
|
|
660
|
-
enumerable: true,
|
|
661
|
-
configurable: true,
|
|
662
|
-
writable: true,
|
|
663
|
-
value: core$1.ContentType.BlockComponent
|
|
664
|
-
});
|
|
591
|
+
ParagraphComponent.componentName = 'ParagraphComponent';
|
|
592
|
+
ParagraphComponent.type = core$1.ContentType.BlockComponent;
|
|
665
593
|
function ParagraphView(props) {
|
|
666
594
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
667
595
|
const readonly = useReadonly();
|
|
@@ -823,42 +751,27 @@ function createCodeSlot() {
|
|
|
823
751
|
class SourceCodeComponent extends core$1.Component {
|
|
824
752
|
constructor() {
|
|
825
753
|
super(...arguments);
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
writable: true,
|
|
836
|
-
value: () => {
|
|
837
|
-
const selection = this.textbus.get(core$1.Selection);
|
|
838
|
-
const slots = this.state.slots;
|
|
839
|
-
const { startSlot, endSlot } = selection;
|
|
840
|
-
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
841
|
-
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
842
|
-
for (; startIndex < endIndex; startIndex++) {
|
|
843
|
-
slots[startIndex].emphasize = false;
|
|
844
|
-
}
|
|
754
|
+
this.focus = new core$1.BehaviorSubject(false);
|
|
755
|
+
this.cancelEmphasize = () => {
|
|
756
|
+
const selection = this.textbus.get(core$1.Selection);
|
|
757
|
+
const slots = this.state.slots;
|
|
758
|
+
const { startSlot, endSlot } = selection;
|
|
759
|
+
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
760
|
+
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
761
|
+
for (; startIndex < endIndex; startIndex++) {
|
|
762
|
+
slots[startIndex].emphasize = false;
|
|
845
763
|
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
856
|
-
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
857
|
-
for (; startIndex < endIndex; startIndex++) {
|
|
858
|
-
slots[startIndex].emphasize = true;
|
|
859
|
-
}
|
|
764
|
+
};
|
|
765
|
+
this.emphasize = () => {
|
|
766
|
+
const selection = this.textbus.get(core$1.Selection);
|
|
767
|
+
const slots = this.state.slots;
|
|
768
|
+
const { startSlot, endSlot } = selection;
|
|
769
|
+
let startIndex = slots.findIndex(i => i.slot === startSlot);
|
|
770
|
+
const endIndex = slots.findIndex(i => i.slot === endSlot) + 1;
|
|
771
|
+
for (; startIndex < endIndex; startIndex++) {
|
|
772
|
+
slots[startIndex].emphasize = true;
|
|
860
773
|
}
|
|
861
|
-
}
|
|
774
|
+
};
|
|
862
775
|
}
|
|
863
776
|
static fromJSON(textbus, json) {
|
|
864
777
|
const registry = textbus.get(core$1.Registry);
|
|
@@ -1030,67 +943,52 @@ class SourceCodeComponent extends core$1.Component {
|
|
|
1030
943
|
});
|
|
1031
944
|
}
|
|
1032
945
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
configurable: true,
|
|
1048
|
-
writable: true,
|
|
1049
|
-
value: {
|
|
1050
|
-
key: 'Enter',
|
|
1051
|
-
match(c) {
|
|
1052
|
-
const matchString = languageList.map(i => i.label || i.value).concat('js', 'ts').join('|').replace(/\+/, '\\+');
|
|
1053
|
-
const reg = new RegExp(`^\`\`\`(${matchString})$`, 'i');
|
|
1054
|
-
return reg.test(c);
|
|
1055
|
-
},
|
|
1056
|
-
createState(content) {
|
|
1057
|
-
const matchString = content.replace(/`/g, '').replace(/\+/, '\\+');
|
|
1058
|
-
for (const item of languageList) {
|
|
1059
|
-
const reg = new RegExp(`^${matchString}$`, 'i');
|
|
1060
|
-
if (reg.test(item.label || item.value)) {
|
|
1061
|
-
return {
|
|
1062
|
-
lang: item.value,
|
|
1063
|
-
theme: '',
|
|
1064
|
-
lineNumber: true,
|
|
1065
|
-
slots: [createCodeSlot()]
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
if (/^js$/i.test(matchString)) {
|
|
1070
|
-
return {
|
|
1071
|
-
lang: 'JavaScript',
|
|
1072
|
-
theme: '',
|
|
1073
|
-
lineNumber: true,
|
|
1074
|
-
slots: [createCodeSlot()]
|
|
1075
|
-
};
|
|
1076
|
-
}
|
|
1077
|
-
if (/^ts$/i.test(matchString)) {
|
|
946
|
+
SourceCodeComponent.type = core$1.ContentType.BlockComponent;
|
|
947
|
+
SourceCodeComponent.componentName = 'SourceCodeComponent';
|
|
948
|
+
SourceCodeComponent.zenCoding = {
|
|
949
|
+
key: 'Enter',
|
|
950
|
+
match(c) {
|
|
951
|
+
const matchString = languageList.map(i => i.label || i.value).concat('js', 'ts').join('|').replace(/\+/, '\\+');
|
|
952
|
+
const reg = new RegExp(`^\`\`\`(${matchString})$`, 'i');
|
|
953
|
+
return reg.test(c);
|
|
954
|
+
},
|
|
955
|
+
createState(content) {
|
|
956
|
+
const matchString = content.replace(/`/g, '').replace(/\+/, '\\+');
|
|
957
|
+
for (const item of languageList) {
|
|
958
|
+
const reg = new RegExp(`^${matchString}$`, 'i');
|
|
959
|
+
if (reg.test(item.label || item.value)) {
|
|
1078
960
|
return {
|
|
1079
|
-
lang:
|
|
961
|
+
lang: item.value,
|
|
1080
962
|
theme: '',
|
|
1081
963
|
lineNumber: true,
|
|
1082
964
|
slots: [createCodeSlot()]
|
|
1083
965
|
};
|
|
1084
966
|
}
|
|
967
|
+
}
|
|
968
|
+
if (/^js$/i.test(matchString)) {
|
|
969
|
+
return {
|
|
970
|
+
lang: 'JavaScript',
|
|
971
|
+
theme: '',
|
|
972
|
+
lineNumber: true,
|
|
973
|
+
slots: [createCodeSlot()]
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
if (/^ts$/i.test(matchString)) {
|
|
1085
977
|
return {
|
|
1086
|
-
lang: '',
|
|
978
|
+
lang: 'TypeScript',
|
|
1087
979
|
theme: '',
|
|
1088
980
|
lineNumber: true,
|
|
1089
981
|
slots: [createCodeSlot()]
|
|
1090
982
|
};
|
|
1091
983
|
}
|
|
984
|
+
return {
|
|
985
|
+
lang: '',
|
|
986
|
+
theme: '',
|
|
987
|
+
lineNumber: true,
|
|
988
|
+
slots: [createCodeSlot()]
|
|
989
|
+
};
|
|
1092
990
|
}
|
|
1093
|
-
}
|
|
991
|
+
};
|
|
1094
992
|
function SourceCodeView(props) {
|
|
1095
993
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
1096
994
|
const isFocus = core.createSignal(false);
|
|
@@ -1182,7 +1080,7 @@ function SourceCodeView(props) {
|
|
|
1182
1080
|
'xnote-source-code': true,
|
|
1183
1081
|
'xnote-source-code-line-number': state.lineNumber,
|
|
1184
1082
|
[state.theme || 'github']: true
|
|
1185
|
-
}, lang: state.lang, "data-auto-break": state.autoBreak, "data-theme": state.theme || null, "data-line-number": state.lineNumber, children: [!readonly() || !output() && jsxRuntime.jsxs(ComponentToolbar, { visible: isFocus(), children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(Dropdown, { onCheck: changeLang, trigger: 'hover', menu: languageList.map(item => {
|
|
1083
|
+
}, lang: state.lang, "data-auto-break": state.autoBreak, "data-theme": state.theme || null, "data-line-number": state.lineNumber, children: [(!readonly() || !output()) && jsxRuntime.jsxs(ComponentToolbar, { visible: isFocus(), children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(Dropdown, { onCheck: changeLang, trigger: 'hover', menu: languageList.map(item => {
|
|
1186
1084
|
return {
|
|
1187
1085
|
label: jsxRuntime.jsx(MenuItem, { checked: state.lang === item.value, children: item.label || 'Plain Text' }),
|
|
1188
1086
|
value: item.value
|
|
@@ -1422,7 +1320,7 @@ function AttrTool(props) {
|
|
|
1422
1320
|
break;
|
|
1423
1321
|
}
|
|
1424
1322
|
}
|
|
1425
|
-
return scopedCss.withScopedCSS(
|
|
1323
|
+
return scopedCss.withScopedCSS(css$b, () => {
|
|
1426
1324
|
const states = checkStates();
|
|
1427
1325
|
return (jsxRuntime.jsx(Dropdown, { style: props.style, abreast: props.abreast, onCheck: updateAttr, trigger: 'hover', menu: [
|
|
1428
1326
|
{
|
|
@@ -1561,24 +1459,9 @@ class TableComponent extends core$1.Component {
|
|
|
1561
1459
|
})
|
|
1562
1460
|
}) {
|
|
1563
1461
|
super(textbus, state);
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
writable: true,
|
|
1568
|
-
value: this.textbus.get(core$1.Selection)
|
|
1569
|
-
});
|
|
1570
|
-
Object.defineProperty(this, "focus", {
|
|
1571
|
-
enumerable: true,
|
|
1572
|
-
configurable: true,
|
|
1573
|
-
writable: true,
|
|
1574
|
-
value: new core$1.Subject()
|
|
1575
|
-
});
|
|
1576
|
-
Object.defineProperty(this, "tableSelection", {
|
|
1577
|
-
enumerable: true,
|
|
1578
|
-
configurable: true,
|
|
1579
|
-
writable: true,
|
|
1580
|
-
value: core.createSignal(null)
|
|
1581
|
-
});
|
|
1462
|
+
this.selection = this.textbus.get(core$1.Selection);
|
|
1463
|
+
this.focus = new core$1.Subject();
|
|
1464
|
+
this.tableSelection = core.createSignal(null);
|
|
1582
1465
|
}
|
|
1583
1466
|
setup() {
|
|
1584
1467
|
core$1.onFocusIn(() => {
|
|
@@ -1703,18 +1586,8 @@ class TableComponent extends core$1.Component {
|
|
|
1703
1586
|
});
|
|
1704
1587
|
}
|
|
1705
1588
|
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
configurable: true,
|
|
1709
|
-
writable: true,
|
|
1710
|
-
value: 'TableComponent'
|
|
1711
|
-
});
|
|
1712
|
-
Object.defineProperty(TableComponent, "type", {
|
|
1713
|
-
enumerable: true,
|
|
1714
|
-
configurable: true,
|
|
1715
|
-
writable: true,
|
|
1716
|
-
value: core$1.ContentType.BlockComponent
|
|
1717
|
-
});
|
|
1589
|
+
TableComponent.componentName = 'TableComponent';
|
|
1590
|
+
TableComponent.type = core$1.ContentType.BlockComponent;
|
|
1718
1591
|
|
|
1719
1592
|
const strikeThroughFormatter = new core$1.Formatter('strike', {
|
|
1720
1593
|
columned: true,
|
|
@@ -1819,37 +1692,22 @@ class TodolistComponent extends core$1.Component {
|
|
|
1819
1692
|
});
|
|
1820
1693
|
}
|
|
1821
1694
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
configurable: true,
|
|
1837
|
-
writable: true,
|
|
1838
|
-
value: {
|
|
1839
|
-
match: /^\[(x|\s)?\]$/,
|
|
1840
|
-
key: ' ',
|
|
1841
|
-
createState(content) {
|
|
1842
|
-
const isChecked = content.charAt(1) === 'x';
|
|
1843
|
-
return {
|
|
1844
|
-
checked: isChecked,
|
|
1845
|
-
slot: new core$1.Slot([
|
|
1846
|
-
core$1.ContentType.InlineComponent,
|
|
1847
|
-
core$1.ContentType.Text
|
|
1848
|
-
])
|
|
1849
|
-
};
|
|
1850
|
-
}
|
|
1695
|
+
TodolistComponent.type = core$1.ContentType.BlockComponent;
|
|
1696
|
+
TodolistComponent.componentName = 'TodoListComponent';
|
|
1697
|
+
TodolistComponent.zenCoding = {
|
|
1698
|
+
match: /^\[(x|\s)?\]$/,
|
|
1699
|
+
key: ' ',
|
|
1700
|
+
createState(content) {
|
|
1701
|
+
const isChecked = content.charAt(1) === 'x';
|
|
1702
|
+
return {
|
|
1703
|
+
checked: isChecked,
|
|
1704
|
+
slot: new core$1.Slot([
|
|
1705
|
+
core$1.ContentType.InlineComponent,
|
|
1706
|
+
core$1.ContentType.Text
|
|
1707
|
+
])
|
|
1708
|
+
};
|
|
1851
1709
|
}
|
|
1852
|
-
}
|
|
1710
|
+
};
|
|
1853
1711
|
function TodolistView(props) {
|
|
1854
1712
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
1855
1713
|
const component = props.component;
|
|
@@ -1923,36 +1781,21 @@ class BlockquoteComponent extends core$1.Component {
|
|
|
1923
1781
|
useBlockContent(this.state.slot);
|
|
1924
1782
|
}
|
|
1925
1783
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
enumerable: true,
|
|
1940
|
-
configurable: true,
|
|
1941
|
-
writable: true,
|
|
1942
|
-
value: {
|
|
1943
|
-
key: ' ',
|
|
1944
|
-
match: /^>$/,
|
|
1945
|
-
createState() {
|
|
1946
|
-
return {
|
|
1947
|
-
slot: new core$1.Slot([
|
|
1948
|
-
core$1.ContentType.Text,
|
|
1949
|
-
core$1.ContentType.InlineComponent,
|
|
1950
|
-
core$1.ContentType.BlockComponent
|
|
1951
|
-
])
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1784
|
+
BlockquoteComponent.type = core$1.ContentType.BlockComponent;
|
|
1785
|
+
BlockquoteComponent.componentName = 'BlockquoteComponent';
|
|
1786
|
+
BlockquoteComponent.zenCoding = {
|
|
1787
|
+
key: ' ',
|
|
1788
|
+
match: /^>$/,
|
|
1789
|
+
createState() {
|
|
1790
|
+
return {
|
|
1791
|
+
slot: new core$1.Slot([
|
|
1792
|
+
core$1.ContentType.Text,
|
|
1793
|
+
core$1.ContentType.InlineComponent,
|
|
1794
|
+
core$1.ContentType.BlockComponent
|
|
1795
|
+
])
|
|
1796
|
+
};
|
|
1954
1797
|
}
|
|
1955
|
-
}
|
|
1798
|
+
};
|
|
1956
1799
|
function BlockquoteView(props) {
|
|
1957
1800
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
1958
1801
|
const readonly = useReadonly();
|
|
@@ -2069,37 +1912,22 @@ class ListComponent extends core$1.Component {
|
|
|
2069
1912
|
});
|
|
2070
1913
|
}
|
|
2071
1914
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
configurable: true,
|
|
2087
|
-
writable: true,
|
|
2088
|
-
value: {
|
|
2089
|
-
key: ' ',
|
|
2090
|
-
match: /^([1-9]\.|[+*])$/,
|
|
2091
|
-
createState(content) {
|
|
2092
|
-
return {
|
|
2093
|
-
type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
|
|
2094
|
-
reorder: true,
|
|
2095
|
-
slot: new core$1.Slot([
|
|
2096
|
-
core$1.ContentType.InlineComponent,
|
|
2097
|
-
core$1.ContentType.Text
|
|
2098
|
-
])
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
1915
|
+
ListComponent.componentName = 'ListComponent';
|
|
1916
|
+
ListComponent.type = core$1.ContentType.BlockComponent;
|
|
1917
|
+
ListComponent.zenCoding = {
|
|
1918
|
+
key: ' ',
|
|
1919
|
+
match: /^([1-9]\.|[+*])$/,
|
|
1920
|
+
createState(content) {
|
|
1921
|
+
return {
|
|
1922
|
+
type: /[-+*]/.test(content) ? 'UnorderedList' : 'OrderedList',
|
|
1923
|
+
reorder: true,
|
|
1924
|
+
slot: new core$1.Slot([
|
|
1925
|
+
core$1.ContentType.InlineComponent,
|
|
1926
|
+
core$1.ContentType.Text
|
|
1927
|
+
])
|
|
1928
|
+
};
|
|
2101
1929
|
}
|
|
2102
|
-
}
|
|
1930
|
+
};
|
|
2103
1931
|
const step = 26;
|
|
2104
1932
|
const chars = Array.from({ length: step }).map((_, index) => String.fromCharCode(96 + index + 1));
|
|
2105
1933
|
function numberToLetter(num) {
|
|
@@ -2189,7 +2017,7 @@ function ListComponentView(props) {
|
|
|
2189
2017
|
}, children: jsxRuntime.jsxs("li", { style: {
|
|
2190
2018
|
justifyContent: align[component.state.slot.getAttribute(textAlignAttr)],
|
|
2191
2019
|
textAlign: component.state.slot.getAttribute(textAlignAttr) === 'justify' ? 'justify' : void 0
|
|
2192
|
-
}, children: [jsxRuntime.jsx("div", { class: "xnote-list-type", children: component.state.type === 'UnorderedList' || readonly() || output() ?
|
|
2020
|
+
}, children: [jsxRuntime.jsx("div", { class: "xnote-list-type", children: (component.state.type === 'UnorderedList' || readonly() || output()) ?
|
|
2193
2021
|
jsxRuntime.jsx("span", { class: "xnote-order-btn", children: icon })
|
|
2194
2022
|
:
|
|
2195
2023
|
jsxRuntime.jsx(Dropdown, { menu: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem, { onClick: () => reorder(false), children: "\u7EE7\u7EED\u7F16\u53F7" }), jsxRuntime.jsx(MenuItem, { onClick: () => reorder(true), children: "\u91CD\u65B0\u7F16\u53F7" })] }), children: jsxRuntime.jsx(Button, { style: { color: 'inherit' }, children: icon }) }) }), adapter.slotRender(component.state.slot, children => {
|
|
@@ -2312,24 +2140,9 @@ class HighlightBoxComponent extends core$1.Component {
|
|
|
2312
2140
|
useBlockContent(this.state.slot);
|
|
2313
2141
|
}
|
|
2314
2142
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
writable: true,
|
|
2319
|
-
value: ['❤️', '💡', '📌', '✅', '❎', '👍', '🎉', '🚫', '❗']
|
|
2320
|
-
});
|
|
2321
|
-
Object.defineProperty(HighlightBoxComponent, "componentName", {
|
|
2322
|
-
enumerable: true,
|
|
2323
|
-
configurable: true,
|
|
2324
|
-
writable: true,
|
|
2325
|
-
value: 'HighlightBoxComponent'
|
|
2326
|
-
});
|
|
2327
|
-
Object.defineProperty(HighlightBoxComponent, "type", {
|
|
2328
|
-
enumerable: true,
|
|
2329
|
-
configurable: true,
|
|
2330
|
-
writable: true,
|
|
2331
|
-
value: core$1.ContentType.BlockComponent
|
|
2332
|
-
});
|
|
2143
|
+
HighlightBoxComponent.defaultTypes = ['❤️', '💡', '📌', '✅', '❎', '👍', '🎉', '🚫', '❗'];
|
|
2144
|
+
HighlightBoxComponent.componentName = 'HighlightBoxComponent';
|
|
2145
|
+
HighlightBoxComponent.type = core$1.ContentType.BlockComponent;
|
|
2333
2146
|
function HighlightBoxView(props) {
|
|
2334
2147
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
2335
2148
|
const readonly = useReadonly();
|
|
@@ -2601,7 +2414,7 @@ function useBlockTransform() {
|
|
|
2601
2414
|
function BlockTool() {
|
|
2602
2415
|
const checkStates = useActiveBlock();
|
|
2603
2416
|
const transform = useBlockTransform();
|
|
2604
|
-
return scopedCss.withScopedCSS(
|
|
2417
|
+
return scopedCss.withScopedCSS(css$b, () => {
|
|
2605
2418
|
const states = checkStates();
|
|
2606
2419
|
const types = [
|
|
2607
2420
|
[states.paragraph, 'xnote-icon-pilcrow'],
|
|
@@ -3032,7 +2845,7 @@ function CodeTool() {
|
|
|
3032
2845
|
};
|
|
3033
2846
|
}
|
|
3034
2847
|
|
|
3035
|
-
var
|
|
2848
|
+
var css$a = undefined;
|
|
3036
2849
|
|
|
3037
2850
|
function ColorTool(props) {
|
|
3038
2851
|
const query = core.inject(core$1.Query);
|
|
@@ -3080,7 +2893,7 @@ function ColorTool(props) {
|
|
|
3080
2893
|
'#90a0e5',
|
|
3081
2894
|
'#c596e0',
|
|
3082
2895
|
];
|
|
3083
|
-
return scopedCss.withScopedCSS(
|
|
2896
|
+
return scopedCss.withScopedCSS(css$a, () => {
|
|
3084
2897
|
const vm = viewModel();
|
|
3085
2898
|
return (jsxRuntime.jsx(Dropdown, { style: props.style, abreast: props.abreast, trigger: 'hover', menu: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { class: "color-type", children: "\u6587\u5B57\u989C\u8272" }), jsxRuntime.jsxs("div", { class: "text-colors", children: [jsxRuntime.jsx("div", { class: {
|
|
3086
2899
|
active: textColor() === ''
|
|
@@ -3288,7 +3101,7 @@ function ItalicTool() {
|
|
|
3288
3101
|
};
|
|
3289
3102
|
}
|
|
3290
3103
|
|
|
3291
|
-
var
|
|
3104
|
+
var css$9 = undefined;
|
|
3292
3105
|
|
|
3293
3106
|
function LinkTool(props) {
|
|
3294
3107
|
const selectionBridge = core.inject(platformBrowser.SelectionBridge);
|
|
@@ -3319,7 +3132,7 @@ function LinkTool(props) {
|
|
|
3319
3132
|
core.onUnmounted(() => {
|
|
3320
3133
|
sub.unsubscribe();
|
|
3321
3134
|
});
|
|
3322
|
-
return scopedCss.withScopedCSS(
|
|
3135
|
+
return scopedCss.withScopedCSS(css$9, () => {
|
|
3323
3136
|
const containerRect = container.getBoundingClientRect();
|
|
3324
3137
|
const rect = isShow() ? selectionBridge.getRect({
|
|
3325
3138
|
slot: selection.focusSlot,
|
|
@@ -3388,7 +3201,7 @@ function UnderlineTool() {
|
|
|
3388
3201
|
};
|
|
3389
3202
|
}
|
|
3390
3203
|
|
|
3391
|
-
var
|
|
3204
|
+
var css$8 = undefined;
|
|
3392
3205
|
|
|
3393
3206
|
function InsertTool(props) {
|
|
3394
3207
|
const commander = core.inject(core$1.Commander);
|
|
@@ -3492,12 +3305,12 @@ function InsertTool(props) {
|
|
|
3492
3305
|
break;
|
|
3493
3306
|
}
|
|
3494
3307
|
}
|
|
3495
|
-
return scopedCss.withScopedCSS(
|
|
3308
|
+
return scopedCss.withScopedCSS(css$8, () => {
|
|
3496
3309
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { class: "btn-group", children: [jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h1" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h2" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h3" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h4" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h5" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h6" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list-numbered" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsxRuntime.jsx("span", { class: "xnote-icon-source-code" }) })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(MenuItem, { onClick: () => insert('table'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('image'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('video'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-warning" }), children: "\u9AD8\u4EAE\u5757" })] });
|
|
3497
3310
|
});
|
|
3498
3311
|
}
|
|
3499
3312
|
|
|
3500
|
-
var
|
|
3313
|
+
var css$7 = undefined;
|
|
3501
3314
|
|
|
3502
3315
|
const LeftToolbar = core.withAnnotation({
|
|
3503
3316
|
providers: [exports.RefreshService]
|
|
@@ -3656,7 +3469,7 @@ const LeftToolbar = core.withAnnotation({
|
|
|
3656
3469
|
}
|
|
3657
3470
|
}
|
|
3658
3471
|
const isEmptyBlock = core.createSignal(true);
|
|
3659
|
-
return scopedCss.withScopedCSS(
|
|
3472
|
+
return scopedCss.withScopedCSS(css$7, () => {
|
|
3660
3473
|
const position = positionSignal();
|
|
3661
3474
|
const slot = activeSlot();
|
|
3662
3475
|
let activeNode = jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" });
|
|
@@ -3701,12 +3514,7 @@ const LeftToolbar = core.withAnnotation({
|
|
|
3701
3514
|
|
|
3702
3515
|
class LeftToolbarPlugin {
|
|
3703
3516
|
constructor() {
|
|
3704
|
-
|
|
3705
|
-
enumerable: true,
|
|
3706
|
-
configurable: true,
|
|
3707
|
-
writable: true,
|
|
3708
|
-
value: null
|
|
3709
|
-
});
|
|
3517
|
+
this.app = null;
|
|
3710
3518
|
}
|
|
3711
3519
|
setup(injector) {
|
|
3712
3520
|
const App = function () {
|
|
@@ -3732,16 +3540,11 @@ class LeftToolbarPlugin {
|
|
|
3732
3540
|
}
|
|
3733
3541
|
}
|
|
3734
3542
|
|
|
3735
|
-
var
|
|
3543
|
+
var css$6 = undefined;
|
|
3736
3544
|
|
|
3737
3545
|
exports.EditorService = class EditorService {
|
|
3738
3546
|
constructor() {
|
|
3739
|
-
|
|
3740
|
-
enumerable: true,
|
|
3741
|
-
configurable: true,
|
|
3742
|
-
writable: true,
|
|
3743
|
-
value: false
|
|
3744
|
-
});
|
|
3547
|
+
this.hideInlineToolbar = false;
|
|
3745
3548
|
}
|
|
3746
3549
|
};
|
|
3747
3550
|
exports.EditorService = __decorate([
|
|
@@ -3847,7 +3650,7 @@ const Toolbar = core.withAnnotation({
|
|
|
3847
3650
|
mousedownSubscription.unsubscribe();
|
|
3848
3651
|
mouseupSubscription.unsubscribe();
|
|
3849
3652
|
});
|
|
3850
|
-
return scopedCss.withScopedCSS(
|
|
3653
|
+
return scopedCss.withScopedCSS(css$6, () => {
|
|
3851
3654
|
const p = viewPosition();
|
|
3852
3655
|
return (jsxRuntime.jsxs("div", { class: "toolbar", ref: toolbarRef, style: {
|
|
3853
3656
|
left: p.left + 'px',
|
|
@@ -3862,12 +3665,7 @@ const Toolbar = core.withAnnotation({
|
|
|
3862
3665
|
|
|
3863
3666
|
class ToolbarPlugin {
|
|
3864
3667
|
constructor() {
|
|
3865
|
-
|
|
3866
|
-
enumerable: true,
|
|
3867
|
-
configurable: true,
|
|
3868
|
-
writable: true,
|
|
3869
|
-
value: null
|
|
3870
|
-
});
|
|
3668
|
+
this.app = null;
|
|
3871
3669
|
}
|
|
3872
3670
|
setup(injector) {
|
|
3873
3671
|
const App = function () {
|
|
@@ -3892,30 +3690,10 @@ class ToolbarPlugin {
|
|
|
3892
3690
|
|
|
3893
3691
|
class Matcher {
|
|
3894
3692
|
constructor(target, rule) {
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
value: target
|
|
3900
|
-
});
|
|
3901
|
-
Object.defineProperty(this, "rule", {
|
|
3902
|
-
enumerable: true,
|
|
3903
|
-
configurable: true,
|
|
3904
|
-
writable: true,
|
|
3905
|
-
value: rule
|
|
3906
|
-
});
|
|
3907
|
-
Object.defineProperty(this, "validators", {
|
|
3908
|
-
enumerable: true,
|
|
3909
|
-
configurable: true,
|
|
3910
|
-
writable: true,
|
|
3911
|
-
value: []
|
|
3912
|
-
});
|
|
3913
|
-
Object.defineProperty(this, "excludeValidators", {
|
|
3914
|
-
enumerable: true,
|
|
3915
|
-
configurable: true,
|
|
3916
|
-
writable: true,
|
|
3917
|
-
value: []
|
|
3918
|
-
});
|
|
3693
|
+
this.target = target;
|
|
3694
|
+
this.rule = rule;
|
|
3695
|
+
this.validators = [];
|
|
3696
|
+
this.excludeValidators = [];
|
|
3919
3697
|
if (rule.tags) {
|
|
3920
3698
|
this.validators.push(this.makeTagsMatcher(rule.tags));
|
|
3921
3699
|
}
|
|
@@ -4012,18 +3790,8 @@ class ImageComponent extends core$1.Component {
|
|
|
4012
3790
|
return new ImageComponent(textbus, Object.assign({}, json));
|
|
4013
3791
|
}
|
|
4014
3792
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
configurable: true,
|
|
4018
|
-
writable: true,
|
|
4019
|
-
value: core$1.ContentType.InlineComponent
|
|
4020
|
-
});
|
|
4021
|
-
Object.defineProperty(ImageComponent, "componentName", {
|
|
4022
|
-
enumerable: true,
|
|
4023
|
-
configurable: true,
|
|
4024
|
-
writable: true,
|
|
4025
|
-
value: 'ImageComponent'
|
|
4026
|
-
});
|
|
3793
|
+
ImageComponent.type = core$1.ContentType.InlineComponent;
|
|
3794
|
+
ImageComponent.componentName = 'ImageComponent';
|
|
4027
3795
|
function ImageView(props) {
|
|
4028
3796
|
const { name, state } = props.component;
|
|
4029
3797
|
const imageRef = core.createRef();
|
|
@@ -4057,12 +3825,7 @@ const imageComponentLoader = {
|
|
|
4057
3825
|
class RootComponent extends core$1.Component {
|
|
4058
3826
|
constructor() {
|
|
4059
3827
|
super(...arguments);
|
|
4060
|
-
|
|
4061
|
-
enumerable: true,
|
|
4062
|
-
configurable: true,
|
|
4063
|
-
writable: true,
|
|
4064
|
-
value: new core$1.Subject()
|
|
4065
|
-
});
|
|
3828
|
+
this.onCompositionStart = new core$1.Subject();
|
|
4066
3829
|
}
|
|
4067
3830
|
static fromJSON(textbus, json) {
|
|
4068
3831
|
const heading = textbus.get(core$1.Registry).createSlot(json.heading);
|
|
@@ -4105,18 +3868,8 @@ class RootComponent extends core$1.Component {
|
|
|
4105
3868
|
content.insert(new ParagraphComponent(this.textbus));
|
|
4106
3869
|
}
|
|
4107
3870
|
}
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
configurable: true,
|
|
4111
|
-
writable: true,
|
|
4112
|
-
value: 'RootComponent'
|
|
4113
|
-
});
|
|
4114
|
-
Object.defineProperty(RootComponent, "type", {
|
|
4115
|
-
enumerable: true,
|
|
4116
|
-
configurable: true,
|
|
4117
|
-
writable: true,
|
|
4118
|
-
value: core$1.ContentType.BlockComponent
|
|
4119
|
-
});
|
|
3871
|
+
RootComponent.componentName = 'RootComponent';
|
|
3872
|
+
RootComponent.type = core$1.ContentType.BlockComponent;
|
|
4120
3873
|
function RootView(props) {
|
|
4121
3874
|
const adapter = core.inject(platformBrowser.DomAdapter);
|
|
4122
3875
|
const { heading, content } = props.component.state;
|
|
@@ -4174,40 +3927,15 @@ const rootComponentLoader = {
|
|
|
4174
3927
|
}
|
|
4175
3928
|
};
|
|
4176
3929
|
|
|
4177
|
-
var
|
|
3930
|
+
var css$5 = undefined;
|
|
4178
3931
|
|
|
4179
3932
|
let TableService = class TableService {
|
|
4180
3933
|
constructor() {
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
});
|
|
4187
|
-
Object.defineProperty(this, "onInsertColumnBefore", {
|
|
4188
|
-
enumerable: true,
|
|
4189
|
-
configurable: true,
|
|
4190
|
-
writable: true,
|
|
4191
|
-
value: new core$1.Subject()
|
|
4192
|
-
});
|
|
4193
|
-
Object.defineProperty(this, "onSelectColumns", {
|
|
4194
|
-
enumerable: true,
|
|
4195
|
-
configurable: true,
|
|
4196
|
-
writable: true,
|
|
4197
|
-
value: new core$1.Subject()
|
|
4198
|
-
});
|
|
4199
|
-
Object.defineProperty(this, "onSelectRows", {
|
|
4200
|
-
enumerable: true,
|
|
4201
|
-
configurable: true,
|
|
4202
|
-
writable: true,
|
|
4203
|
-
value: new core$1.Subject()
|
|
4204
|
-
});
|
|
4205
|
-
Object.defineProperty(this, "onScroll", {
|
|
4206
|
-
enumerable: true,
|
|
4207
|
-
configurable: true,
|
|
4208
|
-
writable: true,
|
|
4209
|
-
value: new core$1.Subject()
|
|
4210
|
-
});
|
|
3934
|
+
this.onInsertRowBefore = new core$1.Subject();
|
|
3935
|
+
this.onInsertColumnBefore = new core$1.Subject();
|
|
3936
|
+
this.onSelectColumns = new core$1.Subject();
|
|
3937
|
+
this.onSelectRows = new core$1.Subject();
|
|
3938
|
+
this.onScroll = new core$1.Subject();
|
|
4211
3939
|
}
|
|
4212
3940
|
};
|
|
4213
3941
|
TableService = __decorate([
|
|
@@ -4286,12 +4014,12 @@ function ResizeColumn(props) {
|
|
|
4286
4014
|
});
|
|
4287
4015
|
return () => sub.unsubscribe();
|
|
4288
4016
|
});
|
|
4289
|
-
return scopedCss.withScopedCSS(
|
|
4017
|
+
return scopedCss.withScopedCSS(css$5, () => {
|
|
4290
4018
|
return jsxRuntime.jsx("div", { ref: dragLineRef, class: ['drag-line'] });
|
|
4291
4019
|
});
|
|
4292
4020
|
}
|
|
4293
4021
|
|
|
4294
|
-
var
|
|
4022
|
+
var css$4 = undefined;
|
|
4295
4023
|
|
|
4296
4024
|
function TopBar(props) {
|
|
4297
4025
|
const editorService = core.inject(exports.EditorService);
|
|
@@ -4359,7 +4087,7 @@ function TopBar(props) {
|
|
|
4359
4087
|
s.unsubscribe();
|
|
4360
4088
|
});
|
|
4361
4089
|
const deleteIndex = core.createSignal(null);
|
|
4362
|
-
return scopedCss.withScopedCSS(
|
|
4090
|
+
return scopedCss.withScopedCSS(css$4, () => {
|
|
4363
4091
|
const { state, tableSelection } = props.component;
|
|
4364
4092
|
const position = tableSelection();
|
|
4365
4093
|
return (jsxRuntime.jsx("div", { class: ['top-bar', {
|
|
@@ -4412,7 +4140,7 @@ function TopBar(props) {
|
|
|
4412
4140
|
});
|
|
4413
4141
|
}
|
|
4414
4142
|
|
|
4415
|
-
var
|
|
4143
|
+
var css$3 = undefined;
|
|
4416
4144
|
|
|
4417
4145
|
function Scroll(props) {
|
|
4418
4146
|
const scrollRef = core.createRef();
|
|
@@ -4444,7 +4172,7 @@ function Scroll(props) {
|
|
|
4444
4172
|
draft.rightEnd = el.scrollLeft === el.scrollWidth - el.offsetWidth;
|
|
4445
4173
|
});
|
|
4446
4174
|
});
|
|
4447
|
-
return scopedCss.withScopedCSS(
|
|
4175
|
+
return scopedCss.withScopedCSS(css$3, () => {
|
|
4448
4176
|
return jsxRuntime.jsx("div", { ref: [scrollRef, props.scrollRef], class: ['scroll-container', {
|
|
4449
4177
|
'left-end': showShadow().leftEnd,
|
|
4450
4178
|
'right-end': showShadow().rightEnd,
|
|
@@ -4456,7 +4184,7 @@ function Scroll(props) {
|
|
|
4456
4184
|
});
|
|
4457
4185
|
}
|
|
4458
4186
|
|
|
4459
|
-
var
|
|
4187
|
+
var css$2 = undefined;
|
|
4460
4188
|
|
|
4461
4189
|
function LeftBar(props) {
|
|
4462
4190
|
const editorService = core.inject(exports.EditorService);
|
|
@@ -4530,7 +4258,7 @@ function LeftBar(props) {
|
|
|
4530
4258
|
textbus.focus();
|
|
4531
4259
|
});
|
|
4532
4260
|
}
|
|
4533
|
-
return scopedCss.withScopedCSS(
|
|
4261
|
+
return scopedCss.withScopedCSS(css$2, () => {
|
|
4534
4262
|
const { state, tableSelection } = props.component;
|
|
4535
4263
|
const position = tableSelection();
|
|
4536
4264
|
return (jsxRuntime.jsxs("div", { class: ['left-bar', { active: props.isFocus() }], children: [jsxRuntime.jsx("div", { class: "insert-bar", children: jsxRuntime.jsx("table", { ref: insertBarRef, children: jsxRuntime.jsx("tbody", { children: state.rows.map((_, index) => {
|
|
@@ -4578,7 +4306,7 @@ function LeftBar(props) {
|
|
|
4578
4306
|
});
|
|
4579
4307
|
}
|
|
4580
4308
|
|
|
4581
|
-
var
|
|
4309
|
+
var css$1 = undefined;
|
|
4582
4310
|
|
|
4583
4311
|
function sum(numbers) {
|
|
4584
4312
|
return numbers.reduce((a, b) => a + b, 0);
|
|
@@ -4611,7 +4339,7 @@ function ResizeRow(props) {
|
|
|
4611
4339
|
});
|
|
4612
4340
|
return () => sub.unsubscribe();
|
|
4613
4341
|
});
|
|
4614
|
-
return scopedCss.withScopedCSS(
|
|
4342
|
+
return scopedCss.withScopedCSS(css$1, () => {
|
|
4615
4343
|
return jsxRuntime.jsx("div", { ref: dragLineRef, style: {
|
|
4616
4344
|
display: styles().visible ? 'block' : 'none',
|
|
4617
4345
|
top: styles().top + 'px',
|
|
@@ -4620,7 +4348,7 @@ function ResizeRow(props) {
|
|
|
4620
4348
|
});
|
|
4621
4349
|
}
|
|
4622
4350
|
|
|
4623
|
-
var
|
|
4351
|
+
var css = undefined;
|
|
4624
4352
|
|
|
4625
4353
|
function SelectionMask(props) {
|
|
4626
4354
|
const [styles, updateStyles] = hooks.useProduce({
|
|
@@ -4673,7 +4401,7 @@ function SelectionMask(props) {
|
|
|
4673
4401
|
core.onUnmounted(() => {
|
|
4674
4402
|
s.unsubscribe();
|
|
4675
4403
|
});
|
|
4676
|
-
return scopedCss.withScopedCSS(
|
|
4404
|
+
return scopedCss.withScopedCSS(css, () => {
|
|
4677
4405
|
const style = styles();
|
|
4678
4406
|
return (jsxRuntime.jsx("div", { class: "mask", style: {
|
|
4679
4407
|
display: style.visible ? 'block' : 'none',
|
|
@@ -4979,18 +4707,8 @@ class VideoComponent extends core$1.Component {
|
|
|
4979
4707
|
//
|
|
4980
4708
|
}
|
|
4981
4709
|
}
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
configurable: true,
|
|
4985
|
-
writable: true,
|
|
4986
|
-
value: core$1.ContentType.InlineComponent
|
|
4987
|
-
});
|
|
4988
|
-
Object.defineProperty(VideoComponent, "componentName", {
|
|
4989
|
-
enumerable: true,
|
|
4990
|
-
configurable: true,
|
|
4991
|
-
writable: true,
|
|
4992
|
-
value: 'VideoComponent'
|
|
4993
|
-
});
|
|
4710
|
+
VideoComponent.type = core$1.ContentType.InlineComponent;
|
|
4711
|
+
VideoComponent.componentName = 'VideoComponent';
|
|
4994
4712
|
function VideoView(props) {
|
|
4995
4713
|
const { name, state } = props.component;
|
|
4996
4714
|
const videoRef = core.createRef();
|
|
@@ -5021,9 +4739,9 @@ const videoComponentLoader = {
|
|
|
5021
4739
|
}
|
|
5022
4740
|
};
|
|
5023
4741
|
|
|
5024
|
-
function createXNote(
|
|
5025
|
-
return __awaiter(this,
|
|
5026
|
-
const adapter = new adapterViewfly.
|
|
4742
|
+
function createXNote(host_1) {
|
|
4743
|
+
return __awaiter(this, arguments, void 0, function* (host, config = {}) {
|
|
4744
|
+
const adapter = new adapterViewfly.ViewflyAdapter({
|
|
5027
4745
|
[ParagraphComponent.componentName]: ParagraphView,
|
|
5028
4746
|
[RootComponent.componentName]: RootView,
|
|
5029
4747
|
[BlockquoteComponent.componentName]: BlockquoteView,
|
|
@@ -5034,8 +4752,8 @@ function createXNote(host, config = {}) {
|
|
|
5034
4752
|
[ListComponent.componentName]: ListComponentView,
|
|
5035
4753
|
[ImageComponent.componentName]: ImageView,
|
|
5036
4754
|
[VideoComponent.componentName]: VideoView
|
|
5037
|
-
}, (host, root) => {
|
|
5038
|
-
const appInjector = new core.ReflectiveInjector(
|
|
4755
|
+
}, (host, root, injector) => {
|
|
4756
|
+
const appInjector = new core.ReflectiveInjector(injector, [{
|
|
5039
4757
|
provide: OutputInjectionToken,
|
|
5040
4758
|
useValue: false
|
|
5041
4759
|
}]);
|
|
@@ -5046,6 +4764,35 @@ function createXNote(host, config = {}) {
|
|
|
5046
4764
|
app.destroy();
|
|
5047
4765
|
};
|
|
5048
4766
|
});
|
|
4767
|
+
const vDomAdapter = new adapterViewfly.ViewflyVDomAdapter({
|
|
4768
|
+
[ParagraphComponent.componentName]: ParagraphView,
|
|
4769
|
+
[RootComponent.componentName]: RootView,
|
|
4770
|
+
[BlockquoteComponent.componentName]: BlockquoteView,
|
|
4771
|
+
[TodolistComponent.componentName]: TodolistView,
|
|
4772
|
+
[SourceCodeComponent.componentName]: SourceCodeView,
|
|
4773
|
+
[TableComponent.componentName]: TableComponentView,
|
|
4774
|
+
[HighlightBoxComponent.componentName]: HighlightBoxView,
|
|
4775
|
+
[ListComponent.componentName]: ListComponentView,
|
|
4776
|
+
[ImageComponent.componentName]: ImageView,
|
|
4777
|
+
[VideoComponent.componentName]: VideoView
|
|
4778
|
+
}, (host, root, injector) => {
|
|
4779
|
+
const appInjector = new core.ReflectiveInjector(injector, [{
|
|
4780
|
+
provide: OutputInjectionToken,
|
|
4781
|
+
useValue: true
|
|
4782
|
+
}, {
|
|
4783
|
+
provide: platformBrowser.DomAdapter,
|
|
4784
|
+
useFactory() {
|
|
4785
|
+
return vDomAdapter;
|
|
4786
|
+
}
|
|
4787
|
+
}]);
|
|
4788
|
+
const app = platformBrowser$1.createApp(root, {
|
|
4789
|
+
context: appInjector,
|
|
4790
|
+
nativeRenderer: new platformBrowser$1.HTMLRenderer()
|
|
4791
|
+
}).mount(host);
|
|
4792
|
+
return () => {
|
|
4793
|
+
app.destroy();
|
|
4794
|
+
};
|
|
4795
|
+
});
|
|
5049
4796
|
const browserModule = new platformBrowser.BrowserModule({
|
|
5050
4797
|
renderTo() {
|
|
5051
4798
|
return host;
|
|
@@ -5085,6 +4832,7 @@ function createXNote(host, config = {}) {
|
|
|
5085
4832
|
modules.push(new collaborate.CollaborateModule(config.collaborateConfig));
|
|
5086
4833
|
}
|
|
5087
4834
|
const textbus = new core$1.Textbus({
|
|
4835
|
+
additionalAdapters: [vDomAdapter],
|
|
5088
4836
|
zenCoding: true,
|
|
5089
4837
|
readonly: config.readonly,
|
|
5090
4838
|
imports: modules,
|
|
@@ -5149,8 +4897,13 @@ function createXNote(host, config = {}) {
|
|
|
5149
4897
|
});
|
|
5150
4898
|
}
|
|
5151
4899
|
yield textbus.render(rootComp);
|
|
5152
|
-
|
|
5153
|
-
return
|
|
4900
|
+
const translator = new platformBrowser$1.OutputTranslator();
|
|
4901
|
+
return {
|
|
4902
|
+
textbus,
|
|
4903
|
+
getHTML() {
|
|
4904
|
+
return translator.transform(vDomAdapter.host);
|
|
4905
|
+
}
|
|
4906
|
+
};
|
|
5154
4907
|
});
|
|
5155
4908
|
}
|
|
5156
4909
|
|