@textbus/xnote 0.0.1-alpha.17 → 0.0.1-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/bundles/components/dropdown/dropdown-menu.d.ts +1 -0
- package/bundles/components/dropdown/dropdown.d.ts +1 -0
- package/bundles/index.css +2 -2
- package/bundles/index.esm.css +2 -2
- package/bundles/index.esm.js +209 -42
- package/bundles/index.js +208 -38
- package/bundles/textbus/components/_api.d.ts +1 -0
- package/bundles/textbus/components/katex/katex-editor.d.ts +7 -0
- package/bundles/textbus/components/katex/katex.component.d.ts +15 -0
- package/package.json +10 -10
package/bundles/index.esm.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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, createRef, withAnnotation, onUpdated, onMounted, InjectionToken,
|
|
3
|
+
import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, createRef, withAnnotation, onUpdated, onMounted, InjectionToken, ReflectiveInjector, createDynamicRef, jsx as jsx$1, viewfly, getCurrentInstance, watch } from '@viewfly/core';
|
|
4
4
|
import { Subject, Selection, fromEvent, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType, Slot, Component, Registry, Query, QueryStateType, createVNode, BehaviorSubject, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, onFocusIn, onFocusOut, onDestroy, onGetRanges, Formatter, onParentSlotUpdated, Textbus, RootComponentRef, filter, map, distinctUntilChanged, sampleTime, merge, debounceTime, throttleTime, delay, onContentInserted, onContentDeleted, switchMap, fromPromise, onCompositionStart } from '@textbus/core';
|
|
5
|
-
import { VIEW_CONTAINER, isMac, DomAdapter, Input, SelectionBridge,
|
|
6
|
-
import { createPortal,
|
|
5
|
+
import { VIEW_CONTAINER, isMac, DomAdapter, Input, SelectionBridge, BrowserModule, VIEW_DOCUMENT, Parser } from '@textbus/platform-browser';
|
|
6
|
+
import { createPortal, createApp, DomRenderer, HTMLRenderer, OutputTranslator } from '@viewfly/platform-browser';
|
|
7
7
|
import { useProduce } from '@viewfly/hooks';
|
|
8
8
|
import highlightjs from 'highlight.js';
|
|
9
|
-
import
|
|
9
|
+
import Katex from 'katex';
|
|
10
10
|
import { ViewflyAdapter, ViewflyVDomAdapter } from '@textbus/adapter-viewfly';
|
|
11
|
+
import { any2Hsl, hsl2Rgb } from '@tanbo/color';
|
|
11
12
|
import { CollaborateModule } from '@textbus/collaborate';
|
|
12
13
|
|
|
13
14
|
var scopedId$m = "vf-3d0183";
|
|
@@ -281,7 +282,7 @@ function DragResize(props) {
|
|
|
281
282
|
|
|
282
283
|
var scopedId$i = "vf-a99c5e";
|
|
283
284
|
|
|
284
|
-
var scopedId$h = "vf-
|
|
285
|
+
var scopedId$h = "vf-d1e8a0";
|
|
285
286
|
|
|
286
287
|
const DropdownMenuPortal = withAnnotation({
|
|
287
288
|
providers: [
|
|
@@ -355,7 +356,6 @@ const DropdownMenuPortal = withAnnotation({
|
|
|
355
356
|
}
|
|
356
357
|
}
|
|
357
358
|
onUpdated(() => {
|
|
358
|
-
console.log(22);
|
|
359
359
|
update();
|
|
360
360
|
});
|
|
361
361
|
onUnmounted(() => {
|
|
@@ -378,7 +378,9 @@ const DropdownMenuPortal = withAnnotation({
|
|
|
378
378
|
return createPortal(withScopedCSS(scopedId$h, () => {
|
|
379
379
|
return (jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
|
|
380
380
|
width: props.width
|
|
381
|
-
}, class: "dropdown-menu", children: jsx("div", { class: "dropdown-menu-content",
|
|
381
|
+
}, class: "dropdown-menu", children: jsx("div", { class: "dropdown-menu-content", style: {
|
|
382
|
+
padding: props.padding
|
|
383
|
+
}, children: props.children }) }));
|
|
382
384
|
}), document.body);
|
|
383
385
|
});
|
|
384
386
|
|
|
@@ -442,7 +444,7 @@ const Dropdown = withAnnotation({
|
|
|
442
444
|
}
|
|
443
445
|
},
|
|
444
446
|
$render: withScopedCSS(scopedId$i, () => {
|
|
445
|
-
return (jsxs("div", { class: ['dropdown', props.class], style: props.style, ref: dropdownRef, children: [jsxs("div", { class: "dropdown-btn", ref: triggerRef, children: [jsx("div", { class: "dropdown-btn-inner", children: props.children }), jsx("div", { class: "dropdown-btn-arrow" })] }), isShow() && jsx(DropdownMenuPortal, { noTrigger: props.trigger === 'none', width: props.width, abreast: props.abreast, triggerRef: triggerRef, children: Array.isArray(props.menu) ?
|
|
447
|
+
return (jsxs("div", { class: ['dropdown', props.class], style: props.style, ref: dropdownRef, children: [jsxs("div", { class: "dropdown-btn", ref: triggerRef, children: [jsx("div", { class: "dropdown-btn-inner", children: props.children }), jsx("div", { class: "dropdown-btn-arrow" })] }), isShow() && jsx(DropdownMenuPortal, { padding: props.padding, noTrigger: props.trigger === 'none', width: props.width, abreast: props.abreast, triggerRef: triggerRef, children: Array.isArray(props.menu) ?
|
|
446
448
|
props.menu.map(menu => {
|
|
447
449
|
return (jsx("div", { class: "dropdown-menu-item", onClick: () => {
|
|
448
450
|
var _a;
|
|
@@ -1158,7 +1160,9 @@ class SourceCodeComponent extends Component {
|
|
|
1158
1160
|
const selection = useContext(Selection);
|
|
1159
1161
|
onBreak(ev => {
|
|
1160
1162
|
const slots = this.state.slots;
|
|
1161
|
-
|
|
1163
|
+
const parentComponent = selection.commonAncestorComponent;
|
|
1164
|
+
const parentSlot = parentComponent.parent;
|
|
1165
|
+
if (parentSlot && ev.target.isEmpty && ev.target === slots[slots.length - 1].slot) {
|
|
1162
1166
|
const prevSlot = slots[slots.length - 2];
|
|
1163
1167
|
if (prevSlot === null || prevSlot === void 0 ? void 0 : prevSlot.slot.isEmpty) {
|
|
1164
1168
|
const slot = new Slot([
|
|
@@ -1168,8 +1172,6 @@ class SourceCodeComponent extends Component {
|
|
|
1168
1172
|
const paragraph = new ParagraphComponent(textbus, {
|
|
1169
1173
|
slot
|
|
1170
1174
|
});
|
|
1171
|
-
const parentComponent = selection.commonAncestorComponent;
|
|
1172
|
-
const parentSlot = parentComponent.parent;
|
|
1173
1175
|
const index = parentSlot.indexOf(parentComponent);
|
|
1174
1176
|
parentSlot.retain(index + 1);
|
|
1175
1177
|
slots.pop();
|
|
@@ -1432,28 +1434,6 @@ function SourceCodeView(props) {
|
|
|
1432
1434
|
}
|
|
1433
1435
|
}
|
|
1434
1436
|
}
|
|
1435
|
-
function nodesToVNodes(slot, nodes, index) {
|
|
1436
|
-
return nodes.map(i => {
|
|
1437
|
-
const location = {
|
|
1438
|
-
slot,
|
|
1439
|
-
startIndex: index,
|
|
1440
|
-
endIndex: index + i.textContent.length
|
|
1441
|
-
};
|
|
1442
|
-
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
1443
|
-
const childNodes = Array.from(i.childNodes);
|
|
1444
|
-
const vEle = createVNode('span', {
|
|
1445
|
-
class: i.className
|
|
1446
|
-
}, nodesToVNodes(slot, childNodes, index));
|
|
1447
|
-
index = location.endIndex;
|
|
1448
|
-
vEle.location = Object.assign({}, location);
|
|
1449
|
-
return vEle;
|
|
1450
|
-
}
|
|
1451
|
-
index = location.endIndex;
|
|
1452
|
-
const textNode = new VTextNode(i.textContent);
|
|
1453
|
-
textNode.location = location;
|
|
1454
|
-
return textNode;
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
1437
|
return (jsxs("div", { ref: props.rootRef, class: {
|
|
1458
1438
|
'xnote-source-code': true,
|
|
1459
1439
|
'xnote-source-code-line-number': state.lineNumber,
|
|
@@ -1514,6 +1494,28 @@ function SourceCodeView(props) {
|
|
|
1514
1494
|
}) }), jsx("span", { class: "xnote-source-code-lang", children: lang })] })] }));
|
|
1515
1495
|
};
|
|
1516
1496
|
}
|
|
1497
|
+
function nodesToVNodes(slot, nodes, index) {
|
|
1498
|
+
return nodes.map(i => {
|
|
1499
|
+
const location = {
|
|
1500
|
+
slot,
|
|
1501
|
+
startIndex: index,
|
|
1502
|
+
endIndex: index + i.textContent.length
|
|
1503
|
+
};
|
|
1504
|
+
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
1505
|
+
const childNodes = Array.from(i.childNodes);
|
|
1506
|
+
const vEle = createVNode('span', {
|
|
1507
|
+
class: i.className
|
|
1508
|
+
}, nodesToVNodes(slot, childNodes, index));
|
|
1509
|
+
index = location.endIndex;
|
|
1510
|
+
vEle.location = Object.assign({}, location);
|
|
1511
|
+
return vEle;
|
|
1512
|
+
}
|
|
1513
|
+
index = location.endIndex;
|
|
1514
|
+
const textNode = new VTextNode(i.textContent);
|
|
1515
|
+
textNode.location = location;
|
|
1516
|
+
return textNode;
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1517
1519
|
const sourceCodeComponentLoader = {
|
|
1518
1520
|
match(element, returnableContentTypes) {
|
|
1519
1521
|
return returnableContentTypes.includes(ContentType.BlockComponent) &&
|
|
@@ -2274,7 +2276,7 @@ class ListComponent extends Component {
|
|
|
2274
2276
|
key: 'Tab'
|
|
2275
2277
|
},
|
|
2276
2278
|
action: () => {
|
|
2277
|
-
|
|
2279
|
+
updateAfterList(this);
|
|
2278
2280
|
return false;
|
|
2279
2281
|
}
|
|
2280
2282
|
});
|
|
@@ -3592,6 +3594,158 @@ const videoComponentLoader = {
|
|
|
3592
3594
|
}
|
|
3593
3595
|
};
|
|
3594
3596
|
|
|
3597
|
+
class KatexEditor extends Textbus {
|
|
3598
|
+
constructor() {
|
|
3599
|
+
const adapter = new ViewflyAdapter({
|
|
3600
|
+
[SourceCodeComponent.componentName]: SourceCodeView
|
|
3601
|
+
}, (host, root, injector) => {
|
|
3602
|
+
const appInjector = new ReflectiveInjector(injector, [{
|
|
3603
|
+
provide: OutputInjectionToken,
|
|
3604
|
+
useValue: true
|
|
3605
|
+
}]);
|
|
3606
|
+
const app = createApp(root, {
|
|
3607
|
+
context: appInjector
|
|
3608
|
+
}).mount(host);
|
|
3609
|
+
return () => {
|
|
3610
|
+
app.destroy();
|
|
3611
|
+
};
|
|
3612
|
+
});
|
|
3613
|
+
const browserModule = new BrowserModule({
|
|
3614
|
+
adapter,
|
|
3615
|
+
renderTo: () => {
|
|
3616
|
+
return this.host;
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
super({
|
|
3620
|
+
components: [
|
|
3621
|
+
SourceCodeComponent
|
|
3622
|
+
],
|
|
3623
|
+
imports: [browserModule]
|
|
3624
|
+
});
|
|
3625
|
+
this.onValueChange = new Subject();
|
|
3626
|
+
}
|
|
3627
|
+
mount(host, code) {
|
|
3628
|
+
this.host = host;
|
|
3629
|
+
const model = new SourceCodeComponent(this, {
|
|
3630
|
+
lineNumber: true,
|
|
3631
|
+
autoBreak: true,
|
|
3632
|
+
lang: 'latex',
|
|
3633
|
+
theme: 'github',
|
|
3634
|
+
slots: code.split('\n').map(i => {
|
|
3635
|
+
const slot = new Slot([ContentType.Text]);
|
|
3636
|
+
slot.insert(i);
|
|
3637
|
+
return {
|
|
3638
|
+
slot,
|
|
3639
|
+
emphasize: false
|
|
3640
|
+
};
|
|
3641
|
+
})
|
|
3642
|
+
});
|
|
3643
|
+
this.onChange.subscribe(() => {
|
|
3644
|
+
const str = model.state.slots.map(i => {
|
|
3645
|
+
if (i.slot.isEmpty) {
|
|
3646
|
+
return '';
|
|
3647
|
+
}
|
|
3648
|
+
return i.slot.toString();
|
|
3649
|
+
}).join('\n');
|
|
3650
|
+
this.onValueChange.next(str);
|
|
3651
|
+
});
|
|
3652
|
+
return this.render(model);
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
class KatexComponent extends Component {
|
|
3657
|
+
static fromJSON(textbus, state) {
|
|
3658
|
+
return new KatexComponent(textbus, state);
|
|
3659
|
+
}
|
|
3660
|
+
constructor(textbus, state = {
|
|
3661
|
+
text: '% \\f is defined as #1f(#2) using the macro\n' +
|
|
3662
|
+
'\\f\\relax{x} = \\int_{-\\infty}^\\infty\n' +
|
|
3663
|
+
'\\f\\hat\\xi\\,e^{2 \\pi i \\xi x}\n' +
|
|
3664
|
+
'\\,d\\xi'
|
|
3665
|
+
}) {
|
|
3666
|
+
super(textbus, state);
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
KatexComponent.componentName = 'KatexComponent';
|
|
3670
|
+
KatexComponent.type = ContentType.InlineComponent;
|
|
3671
|
+
function domToVDom(el) {
|
|
3672
|
+
const attrs = {};
|
|
3673
|
+
el.getAttributeNames().forEach(key => {
|
|
3674
|
+
attrs[key] = el.getAttribute(key);
|
|
3675
|
+
});
|
|
3676
|
+
attrs.children = Array.from(el.childNodes).map(child => {
|
|
3677
|
+
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
3678
|
+
return domToVDom(child);
|
|
3679
|
+
}
|
|
3680
|
+
return child.textContent || '';
|
|
3681
|
+
});
|
|
3682
|
+
return jsx$1(el.tagName.toLowerCase(), attrs);
|
|
3683
|
+
}
|
|
3684
|
+
function KatexComponentView(props) {
|
|
3685
|
+
function toDOM(value) {
|
|
3686
|
+
let htmlString;
|
|
3687
|
+
try {
|
|
3688
|
+
htmlString = Katex.renderToString(value, {
|
|
3689
|
+
displayMode: true,
|
|
3690
|
+
leqno: false,
|
|
3691
|
+
fleqn: false,
|
|
3692
|
+
throwOnError: true,
|
|
3693
|
+
errorColor: '#cc0000',
|
|
3694
|
+
strict: 'warn',
|
|
3695
|
+
output: 'html',
|
|
3696
|
+
trust: false,
|
|
3697
|
+
macros: { '\\f': '#1f(#2)' }
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
catch (e) {
|
|
3701
|
+
htmlString = '<span style="color: red">公式错误</span>';
|
|
3702
|
+
}
|
|
3703
|
+
return new DOMParser().parseFromString(htmlString, 'text/html').body.children[0];
|
|
3704
|
+
}
|
|
3705
|
+
const selection = inject(Textbus);
|
|
3706
|
+
const editorRef = createDynamicRef(node => {
|
|
3707
|
+
const editor = new KatexEditor();
|
|
3708
|
+
editor.mount(node, props.component.state.text).then(() => {
|
|
3709
|
+
editor.focus();
|
|
3710
|
+
});
|
|
3711
|
+
selection.blur();
|
|
3712
|
+
const subscription = editor.onValueChange.subscribe((value) => {
|
|
3713
|
+
props.component.state.text = value;
|
|
3714
|
+
}).add(fromEvent(node, 'mousedown').subscribe(ev => ev.stopPropagation()), fromEvent(document, 'mousedown').subscribe(() => {
|
|
3715
|
+
var _a;
|
|
3716
|
+
(_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(false);
|
|
3717
|
+
}));
|
|
3718
|
+
return () => {
|
|
3719
|
+
subscription.unsubscribe();
|
|
3720
|
+
editor.destroy();
|
|
3721
|
+
};
|
|
3722
|
+
});
|
|
3723
|
+
const dropdownRef = createRef();
|
|
3724
|
+
const output = useOutput();
|
|
3725
|
+
const readonly = useReadonly();
|
|
3726
|
+
return () => {
|
|
3727
|
+
const text = props.component.state.text;
|
|
3728
|
+
return (jsx("span", { onClick: () => {
|
|
3729
|
+
var _a;
|
|
3730
|
+
(_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(true);
|
|
3731
|
+
}, ref: props.rootRef, "data-component": KatexComponent.componentName, "data-katex": btoa(text), class: "xnote-katex", children: (output() || readonly()) ?
|
|
3732
|
+
domToVDom(toDOM(text))
|
|
3733
|
+
:
|
|
3734
|
+
jsx(Dropdown, { padding: '0', ref: dropdownRef, trigger: 'none', width: '600px', menu: jsx("div", { class: "xnote-katex-input", ref: editorRef }), children: domToVDom(toDOM(text)) }) }));
|
|
3735
|
+
};
|
|
3736
|
+
}
|
|
3737
|
+
const katexComponentLoader = {
|
|
3738
|
+
match(element) {
|
|
3739
|
+
return element.dataset.component === KatexComponent.componentName;
|
|
3740
|
+
},
|
|
3741
|
+
read(element, textbus) {
|
|
3742
|
+
const value = element.dataset.katex || '';
|
|
3743
|
+
return new KatexComponent(textbus, {
|
|
3744
|
+
text: atob(value)
|
|
3745
|
+
});
|
|
3746
|
+
}
|
|
3747
|
+
};
|
|
3748
|
+
|
|
3595
3749
|
function InsertTool(props) {
|
|
3596
3750
|
const commander = inject(Commander);
|
|
3597
3751
|
const selection = inject(Selection);
|
|
@@ -3719,10 +3873,19 @@ function InsertTool(props) {
|
|
|
3719
3873
|
selection.setPosition(p.state.slot, 0);
|
|
3720
3874
|
}
|
|
3721
3875
|
break;
|
|
3876
|
+
case 'katex':
|
|
3877
|
+
{
|
|
3878
|
+
const p = new ParagraphComponent(textbus);
|
|
3879
|
+
const comp = new KatexComponent(textbus);
|
|
3880
|
+
p.state.slot.insert(comp);
|
|
3881
|
+
insertComponent(p);
|
|
3882
|
+
selection.selectComponent(comp);
|
|
3883
|
+
}
|
|
3884
|
+
break;
|
|
3722
3885
|
}
|
|
3723
3886
|
}
|
|
3724
3887
|
return withScopedCSS(scopedId$8, () => {
|
|
3725
|
-
return jsxs(Fragment, { children: [props.hideTitle ? null : jsx(MenuHeading, { children: props.replace ? '替换为' : '在下面添加' }), jsxs("div", { class: "btn-group", children: [jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsx("span", { class: "xnote-icon-pilcrow" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsx("span", { class: "xnote-icon-heading-h1" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsx("span", { class: "xnote-icon-heading-h2" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsx("span", { class: "xnote-icon-heading-h3" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsx("span", { class: "xnote-icon-heading-h4" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsx("span", { class: "xnote-icon-heading-h5" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsx("span", { class: "xnote-icon-heading-h6" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsx("span", { class: "xnote-icon-list-numbered" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsx("span", { class: "xnote-icon-list" }) }), jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsx("span", { class: "xnote-icon-source-code" }) })] }), jsx(Divider, {}), jsx(MenuItem, { onClick: () => insert('table'), icon: jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsx(MenuItem, { onClick: () => insert('image'), icon: jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsx(MenuItem, { onClick: () => insert('video'), icon: jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsx("span", { class: "xnote-icon-warning" }), children: "\u9AD8\u4EAE\u5757" })] });
|
|
3888
|
+
return jsxs(Fragment, { children: [props.hideTitle ? null : jsx(MenuHeading, { children: props.replace ? '替换为' : '在下面添加' }), jsxs("div", { class: "btn-group", children: [jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsx("span", { class: "xnote-icon-pilcrow" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsx("span", { class: "xnote-icon-heading-h1" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsx("span", { class: "xnote-icon-heading-h2" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsx("span", { class: "xnote-icon-heading-h3" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsx("span", { class: "xnote-icon-heading-h4" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsx("span", { class: "xnote-icon-heading-h5" }) }), jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsx("span", { class: "xnote-icon-heading-h6" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsx("span", { class: "xnote-icon-list-numbered" }) }), jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsx("span", { class: "xnote-icon-list" }) }), jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsx("span", { class: "xnote-icon-source-code" }) })] }), jsx(Divider, {}), jsx(MenuItem, { onClick: () => insert('table'), icon: jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsx(MenuItem, { onClick: () => insert('image'), icon: jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsx(MenuItem, { onClick: () => insert('video'), icon: jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsx("span", { class: "xnote-icon-warning" }), children: "\u9AD8\u4EAE\u5757" }), jsx(MenuItem, { onClick: () => insert('katex'), icon: jsx("span", { class: "xnote-icon-opt" }), children: "\u6570\u5B66\u516C\u5F0F" })] });
|
|
3726
3889
|
});
|
|
3727
3890
|
}
|
|
3728
3891
|
|
|
@@ -4688,7 +4851,7 @@ function TopBar(props) {
|
|
|
4688
4851
|
});
|
|
4689
4852
|
}
|
|
4690
4853
|
|
|
4691
|
-
var scopedId$3 = "vf-
|
|
4854
|
+
var scopedId$3 = "vf-c3d159";
|
|
4692
4855
|
|
|
4693
4856
|
function Scroll(props) {
|
|
4694
4857
|
const scrollRef = createRef();
|
|
@@ -5196,6 +5359,7 @@ class Editor extends Textbus {
|
|
|
5196
5359
|
[ImageComponent.componentName]: ImageView,
|
|
5197
5360
|
[VideoComponent.componentName]: VideoView,
|
|
5198
5361
|
[AtComponent.componentName]: AtComponentView,
|
|
5362
|
+
[KatexComponent.componentName]: KatexComponentView,
|
|
5199
5363
|
}, (host, root, injector) => {
|
|
5200
5364
|
const appInjector = new ReflectiveInjector(injector, [{
|
|
5201
5365
|
provide: OutputInjectionToken,
|
|
@@ -5213,14 +5377,15 @@ class Editor extends Textbus {
|
|
|
5213
5377
|
}, adapter, componentLoaders: [
|
|
5214
5378
|
atComponentLoader,
|
|
5215
5379
|
sourceCodeComponentLoader,
|
|
5380
|
+
listComponentLoader,
|
|
5216
5381
|
tableComponentLoader,
|
|
5217
5382
|
imageComponentLoader,
|
|
5218
|
-
videoComponentLoader,
|
|
5219
5383
|
highlightBoxComponentLoader,
|
|
5220
5384
|
blockquoteComponentLoader,
|
|
5221
|
-
|
|
5385
|
+
videoComponentLoader,
|
|
5222
5386
|
todolistComponentLoader,
|
|
5223
|
-
|
|
5387
|
+
katexComponentLoader,
|
|
5388
|
+
paragraphComponentLoader,
|
|
5224
5389
|
], formatLoaders: [
|
|
5225
5390
|
backgroundColorFormatLoader,
|
|
5226
5391
|
boldFormatLoader,
|
|
@@ -5252,7 +5417,8 @@ class Editor extends Textbus {
|
|
|
5252
5417
|
[ListComponent.componentName]: ListComponentView,
|
|
5253
5418
|
[ImageComponent.componentName]: ImageView,
|
|
5254
5419
|
[VideoComponent.componentName]: VideoView,
|
|
5255
|
-
[AtComponent.componentName]: AtComponentView
|
|
5420
|
+
[AtComponent.componentName]: AtComponentView,
|
|
5421
|
+
[KatexComponent.componentName]: KatexComponentView
|
|
5256
5422
|
}, (host, root, injector) => {
|
|
5257
5423
|
const appInjector = new ReflectiveInjector(injector, [{
|
|
5258
5424
|
provide: OutputInjectionToken,
|
|
@@ -5282,7 +5448,8 @@ class Editor extends Textbus {
|
|
|
5282
5448
|
HighlightBoxComponent,
|
|
5283
5449
|
ListComponent,
|
|
5284
5450
|
VideoComponent,
|
|
5285
|
-
AtComponent
|
|
5451
|
+
AtComponent,
|
|
5452
|
+
KatexComponent
|
|
5286
5453
|
], formatters: [
|
|
5287
5454
|
backgroundColorFormatter,
|
|
5288
5455
|
boldFormatter,
|
|
@@ -5354,4 +5521,4 @@ class Editor extends Textbus {
|
|
|
5354
5521
|
}
|
|
5355
5522
|
}
|
|
5356
5523
|
|
|
5357
|
-
export { AtComponent, AtComponentView, AttrTool, BlockTool, BlockquoteComponent, BlockquoteView, BoldTool, Button, CodeTool, ColorTool, ComponentToolbar, Divider, DragResize, Dropdown, DropdownContextService, DropdownMenuPortal, DropdownService, Editor, EditorService, FontFamilyTool, FontSizeTool, HighlightBoxComponent, HighlightBoxView, ImageComponent, ImageView, InsertTool, ItalicTool, Keymap, LeftToolbar, LeftToolbarPlugin, LinkTool, ListComponent, ListComponentView, Matcher, MenuHeading, MenuItem, Organization, OutputInjectionToken, ParagraphComponent, ParagraphView, Popup, RefreshService, RootComponent, RootView, SourceCodeComponent, SourceCodeView, StrikeThroughTool, TableComponent, TableComponentView, TodolistComponent, TodolistView, Toolbar, ToolbarItem, ToolbarPlugin, UnderlineTool, VideoComponent, VideoView, atComponentLoader, autoComplete, backgroundColorFormatLoader, backgroundColorFormatter, blockquoteComponentLoader, boldFormatLoader, boldFormatter, codeFormatLoader, codeFormatter, colorFormatLoader, colorFormatter, deltaToBlock, fontFamilyFormatLoader, fontFamilyFormatter, fontSizeFormatLoader, fontSizeFormatter, headingAttr, headingAttrLoader, highlightBoxComponentLoader, imageComponentLoader, isSupportFont, italicFormatLoader, italicFormatter, languageList, linkFormatLoader, linkFormatter, listComponentLoader, paragraphComponentLoader, registerAtShortcut, registerBlockquoteShortcut, registerBoldShortcut, registerCodeShortcut, registerHeadingShortcut, registerItalicShortcut, registerListShortcut, registerStrikeThroughShortcut, registerTextAlignShortcut, registerTextIndentShortcut, registerUnderlineShortcut, rootComponentLoader, sourceCodeComponentLoader, sourceCodeThemes, strikeThroughFormatLoader, strikeThroughFormatter, tableComponentLoader, textAlignAttr, textAlignAttrLoader, textIndentAttr, textIndentAttrLoader, toBlockquote, toList, todolistComponentLoader, toggleBold, toggleCode, toggleItalic, toggleStrikeThrough, toggleUnderline, underlineFormatLoader, underlineFormatter, useActiveBlock, useBlockContent, useBlockTransform, useOutput, useReadonly, videoComponentLoader };
|
|
5524
|
+
export { AtComponent, AtComponentView, AttrTool, BlockTool, BlockquoteComponent, BlockquoteView, BoldTool, Button, CodeTool, ColorTool, ComponentToolbar, Divider, DragResize, Dropdown, DropdownContextService, DropdownMenuPortal, DropdownService, Editor, EditorService, FontFamilyTool, FontSizeTool, HighlightBoxComponent, HighlightBoxView, ImageComponent, ImageView, InsertTool, ItalicTool, KatexComponent, KatexComponentView, Keymap, LeftToolbar, LeftToolbarPlugin, LinkTool, ListComponent, ListComponentView, Matcher, MenuHeading, MenuItem, Organization, OutputInjectionToken, ParagraphComponent, ParagraphView, Popup, RefreshService, RootComponent, RootView, SourceCodeComponent, SourceCodeView, StrikeThroughTool, TableComponent, TableComponentView, TodolistComponent, TodolistView, Toolbar, ToolbarItem, ToolbarPlugin, UnderlineTool, VideoComponent, VideoView, atComponentLoader, autoComplete, backgroundColorFormatLoader, backgroundColorFormatter, blockquoteComponentLoader, boldFormatLoader, boldFormatter, codeFormatLoader, codeFormatter, colorFormatLoader, colorFormatter, deltaToBlock, fontFamilyFormatLoader, fontFamilyFormatter, fontSizeFormatLoader, fontSizeFormatter, headingAttr, headingAttrLoader, highlightBoxComponentLoader, imageComponentLoader, isSupportFont, italicFormatLoader, italicFormatter, katexComponentLoader, languageList, linkFormatLoader, linkFormatter, listComponentLoader, paragraphComponentLoader, registerAtShortcut, registerBlockquoteShortcut, registerBoldShortcut, registerCodeShortcut, registerHeadingShortcut, registerItalicShortcut, registerListShortcut, registerStrikeThroughShortcut, registerTextAlignShortcut, registerTextIndentShortcut, registerUnderlineShortcut, rootComponentLoader, sourceCodeComponentLoader, sourceCodeThemes, strikeThroughFormatLoader, strikeThroughFormatter, tableComponentLoader, textAlignAttr, textAlignAttrLoader, textIndentAttr, textIndentAttrLoader, toBlockquote, toList, todolistComponentLoader, toggleBold, toggleCode, toggleItalic, toggleStrikeThrough, toggleUnderline, underlineFormatLoader, underlineFormatter, useActiveBlock, useBlockContent, useBlockTransform, useOutput, useReadonly, videoComponentLoader };
|