@textbus/xnote 0.2.7 → 0.3.0
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 +6 -0
- package/bundles/editor.d.ts +7 -2
- package/bundles/index.esm.js +35 -19
- package/bundles/index.js +35 -19
- package/index.tsx +151 -0
- package/package.json +10 -10
package/README.md
CHANGED
package/bundles/editor.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { OutputTranslator } from '@viewfly/platform-browser';
|
|
2
2
|
import { ViewOptions } from '@textbus/platform-browser';
|
|
3
3
|
import { CollaborateConfig } from '@textbus/collaborate';
|
|
4
|
-
import { Textbus, TextbusConfig } from '@textbus/core';
|
|
4
|
+
import { ComponentStateLiteral, Textbus, TextbusConfig } from '@textbus/core';
|
|
5
5
|
import './assets/icons/style.css';
|
|
6
|
+
import { RootComponentState } from './textbus/components/_api';
|
|
6
7
|
import './textbus/doc.scss';
|
|
7
8
|
export interface XNoteCollaborateConfig extends CollaborateConfig {
|
|
8
9
|
userinfo: {
|
|
@@ -16,7 +17,7 @@ export interface XNoteCollaborateConfig extends CollaborateConfig {
|
|
|
16
17
|
*/
|
|
17
18
|
export interface EditorConfig extends TextbusConfig {
|
|
18
19
|
/** 默认 HTML 内容*/
|
|
19
|
-
content?: string
|
|
20
|
+
content?: string | ComponentStateLiteral<RootComponentState>;
|
|
20
21
|
/** 协作服务配置 */
|
|
21
22
|
collaborateConfig?: XNoteCollaborateConfig;
|
|
22
23
|
/** 视图配置项 */
|
|
@@ -29,5 +30,9 @@ export declare class Editor extends Textbus {
|
|
|
29
30
|
private vDomAdapter;
|
|
30
31
|
constructor(editorConfig?: EditorConfig);
|
|
31
32
|
mount(host: HTMLElement): Promise<this>;
|
|
33
|
+
setContent(content: string | ComponentStateLiteral<RootComponentState>): void;
|
|
32
34
|
getHTML(): string;
|
|
35
|
+
private createModel;
|
|
36
|
+
private createModelFromState;
|
|
37
|
+
private createModelFromHTML;
|
|
33
38
|
}
|
package/bundles/index.esm.js
CHANGED
|
@@ -6348,7 +6348,6 @@ class RootComponent extends Component {
|
|
|
6348
6348
|
RootComponent.componentName = 'RootComponent';
|
|
6349
6349
|
RootComponent.type = ContentType.BlockComponent;
|
|
6350
6350
|
function RootView(props) {
|
|
6351
|
-
const { content } = props.component.state;
|
|
6352
6351
|
const ref = createDynamicRef(node => {
|
|
6353
6352
|
const sub = props.component.onCompositionStart.subscribe(() => {
|
|
6354
6353
|
node.children[0].dataset.placeholder = '';
|
|
@@ -6370,6 +6369,7 @@ function RootView(props) {
|
|
|
6370
6369
|
}
|
|
6371
6370
|
return () => {
|
|
6372
6371
|
const { rootRef } = props;
|
|
6372
|
+
const { content } = props.component.state;
|
|
6373
6373
|
return (jsx("div", { class: "xnote-root", onClick: checkContent, style: !readonly() ? {
|
|
6374
6374
|
paddingBottom: '40px'
|
|
6375
6375
|
} : {}, dir: "auto", ref: [rootRef, containerRef, ref], "data-component": props.component.name, children: jsx(SlotRender, { slot: content, tag: "div", class: "xnote-content", "data-placeholder": content.isEmpty ? '请输入内容' : '', renderEnv: readonly() || output() }) }));
|
|
@@ -7556,24 +7556,7 @@ class Editor extends Textbus {
|
|
|
7556
7556
|
let rootComp;
|
|
7557
7557
|
const config = this.editorConfig;
|
|
7558
7558
|
if (config.content) {
|
|
7559
|
-
|
|
7560
|
-
const doc = parser.parseDoc(config.content, rootComponentLoader);
|
|
7561
|
-
if (doc instanceof Component) {
|
|
7562
|
-
rootComp = doc;
|
|
7563
|
-
}
|
|
7564
|
-
else {
|
|
7565
|
-
const content = new Slot([
|
|
7566
|
-
ContentType.BlockComponent
|
|
7567
|
-
]);
|
|
7568
|
-
if (doc instanceof Slot) {
|
|
7569
|
-
deltaToBlock(doc.toDelta(), this).forEach(i => {
|
|
7570
|
-
content.insert(i);
|
|
7571
|
-
});
|
|
7572
|
-
}
|
|
7573
|
-
rootComp = new RootComponent(this, {
|
|
7574
|
-
content
|
|
7575
|
-
});
|
|
7576
|
-
}
|
|
7559
|
+
rootComp = this.createModel(config.content);
|
|
7577
7560
|
}
|
|
7578
7561
|
else {
|
|
7579
7562
|
rootComp = new RootComponent(this, {
|
|
@@ -7582,9 +7565,42 @@ class Editor extends Textbus {
|
|
|
7582
7565
|
}
|
|
7583
7566
|
return this.render(rootComp);
|
|
7584
7567
|
}
|
|
7568
|
+
setContent(content) {
|
|
7569
|
+
this.guardReady();
|
|
7570
|
+
const newModel = this.createModel(content);
|
|
7571
|
+
const rootComponent = this.get(RootComponentRef).component;
|
|
7572
|
+
Object.assign(rootComponent.state, newModel.state);
|
|
7573
|
+
}
|
|
7585
7574
|
getHTML() {
|
|
7586
7575
|
return this.translator.transform(this.vDomAdapter.host);
|
|
7587
7576
|
}
|
|
7577
|
+
createModel(content) {
|
|
7578
|
+
if (typeof content === 'string') {
|
|
7579
|
+
return this.createModelFromHTML(content);
|
|
7580
|
+
}
|
|
7581
|
+
return this.createModelFromState(content);
|
|
7582
|
+
}
|
|
7583
|
+
createModelFromState(state) {
|
|
7584
|
+
return RootComponent.fromJSON(this, state);
|
|
7585
|
+
}
|
|
7586
|
+
createModelFromHTML(html) {
|
|
7587
|
+
const parser = this.get(Parser);
|
|
7588
|
+
const doc = parser.parseDoc(html, rootComponentLoader);
|
|
7589
|
+
if (doc instanceof Component) {
|
|
7590
|
+
return doc;
|
|
7591
|
+
}
|
|
7592
|
+
const content = new Slot([
|
|
7593
|
+
ContentType.BlockComponent
|
|
7594
|
+
]);
|
|
7595
|
+
if (doc instanceof Slot) {
|
|
7596
|
+
deltaToBlock(doc.toDelta(), this).forEach(i => {
|
|
7597
|
+
content.insert(i);
|
|
7598
|
+
});
|
|
7599
|
+
}
|
|
7600
|
+
return new RootComponent(this, {
|
|
7601
|
+
content
|
|
7602
|
+
});
|
|
7603
|
+
}
|
|
7588
7604
|
}
|
|
7589
7605
|
|
|
7590
7606
|
export { AtComponent, AtComponentView, AttrTool, BlockTool, BlockquoteComponent, BlockquoteView, BoldTool, Button, CellAlignTool, CellBackgroundTool, CleanFormatsTool, CodeTool, ColorPicker, ComponentToolbar, Divider, DragResize, Dropdown, DropdownContextService, DropdownMenuContainer, DropdownMenuPortal, DropdownService, Editor, EditorService, FileUploader, FontFamilyTool, FontSizeTool, HighlightBoxComponent, HighlightBoxView, ImageComponent, ImageView, InlineToolbar, InlineToolbarPlugin, InsertMenu, InsertTool, ItalicTool, KatexComponent, KatexComponentView, Keymap, LeftToolbar, LeftToolbarPlugin, LinkJump, LinkTool, ListComponent, ListComponentView, Matcher, MenuHeading, MenuItem, MergeCellsTool, Organization, OutputInjectionToken, ParagraphComponent, ParagraphView, Picker, Popup, RedoTool, RefreshService, RootComponent, RootView, SourceCodeComponent, SourceCodeView, SplitCellsTool, SplitLine, StaticToolbar, StaticToolbarPlugin, StrikeThroughTool, SubscriptTool, SuperscriptTool, SuspensionToolbar, SuspensionToolbarPlugin, TableComponent, TableComponentView, TextBackgroundColorTool, TextColorTool, TodolistComponent, TodolistView, ToolbarItem, UnderlineTool, UndoTool, VideoComponent, VideoView, XNoteMessageBus, atComponentLoader, backgroundColorFormatLoader, backgroundColorFormatter, blockquoteComponentLoader, boldFormatLoader, boldFormatter, cellAlignAttr, cellAlignAttrLoader, cellBackgroundAttr, cellBackgroundAttrLoader, 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, subscriptFormatLoader, subscriptFormatter, superscriptFormatLoader, superscriptFormatter, tableComponentLoader, textAlignAttr, textAlignAttrLoader, textIndentAttr, textIndentAttrLoader, toBlockquote, toList, todolistComponentLoader, toggleBold, toggleCode, toggleItalic, toggleStrikeThrough, toggleUnderline, underlineFormatLoader, underlineFormatter, useActiveBlock, useBlockContent, useBlockTransform, useOutput, useReadonly, videoComponentLoader };
|
package/bundles/index.js
CHANGED
|
@@ -6350,7 +6350,6 @@ class RootComponent extends core$1.Component {
|
|
|
6350
6350
|
RootComponent.componentName = 'RootComponent';
|
|
6351
6351
|
RootComponent.type = core$1.ContentType.BlockComponent;
|
|
6352
6352
|
function RootView(props) {
|
|
6353
|
-
const { content } = props.component.state;
|
|
6354
6353
|
const ref = core.createDynamicRef(node => {
|
|
6355
6354
|
const sub = props.component.onCompositionStart.subscribe(() => {
|
|
6356
6355
|
node.children[0].dataset.placeholder = '';
|
|
@@ -6372,6 +6371,7 @@ function RootView(props) {
|
|
|
6372
6371
|
}
|
|
6373
6372
|
return () => {
|
|
6374
6373
|
const { rootRef } = props;
|
|
6374
|
+
const { content } = props.component.state;
|
|
6375
6375
|
return (jsxRuntime.jsx("div", { class: "xnote-root", onClick: checkContent, style: !readonly() ? {
|
|
6376
6376
|
paddingBottom: '40px'
|
|
6377
6377
|
} : {}, dir: "auto", ref: [rootRef, containerRef, ref], "data-component": props.component.name, children: jsxRuntime.jsx(SlotRender, { slot: content, tag: "div", class: "xnote-content", "data-placeholder": content.isEmpty ? '请输入内容' : '', renderEnv: readonly() || output() }) }));
|
|
@@ -7558,24 +7558,7 @@ class Editor extends core$1.Textbus {
|
|
|
7558
7558
|
let rootComp;
|
|
7559
7559
|
const config = this.editorConfig;
|
|
7560
7560
|
if (config.content) {
|
|
7561
|
-
|
|
7562
|
-
const doc = parser.parseDoc(config.content, rootComponentLoader);
|
|
7563
|
-
if (doc instanceof core$1.Component) {
|
|
7564
|
-
rootComp = doc;
|
|
7565
|
-
}
|
|
7566
|
-
else {
|
|
7567
|
-
const content = new core$1.Slot([
|
|
7568
|
-
core$1.ContentType.BlockComponent
|
|
7569
|
-
]);
|
|
7570
|
-
if (doc instanceof core$1.Slot) {
|
|
7571
|
-
deltaToBlock(doc.toDelta(), this).forEach(i => {
|
|
7572
|
-
content.insert(i);
|
|
7573
|
-
});
|
|
7574
|
-
}
|
|
7575
|
-
rootComp = new RootComponent(this, {
|
|
7576
|
-
content
|
|
7577
|
-
});
|
|
7578
|
-
}
|
|
7561
|
+
rootComp = this.createModel(config.content);
|
|
7579
7562
|
}
|
|
7580
7563
|
else {
|
|
7581
7564
|
rootComp = new RootComponent(this, {
|
|
@@ -7584,9 +7567,42 @@ class Editor extends core$1.Textbus {
|
|
|
7584
7567
|
}
|
|
7585
7568
|
return this.render(rootComp);
|
|
7586
7569
|
}
|
|
7570
|
+
setContent(content) {
|
|
7571
|
+
this.guardReady();
|
|
7572
|
+
const newModel = this.createModel(content);
|
|
7573
|
+
const rootComponent = this.get(core$1.RootComponentRef).component;
|
|
7574
|
+
Object.assign(rootComponent.state, newModel.state);
|
|
7575
|
+
}
|
|
7587
7576
|
getHTML() {
|
|
7588
7577
|
return this.translator.transform(this.vDomAdapter.host);
|
|
7589
7578
|
}
|
|
7579
|
+
createModel(content) {
|
|
7580
|
+
if (typeof content === 'string') {
|
|
7581
|
+
return this.createModelFromHTML(content);
|
|
7582
|
+
}
|
|
7583
|
+
return this.createModelFromState(content);
|
|
7584
|
+
}
|
|
7585
|
+
createModelFromState(state) {
|
|
7586
|
+
return RootComponent.fromJSON(this, state);
|
|
7587
|
+
}
|
|
7588
|
+
createModelFromHTML(html) {
|
|
7589
|
+
const parser = this.get(platformBrowser.Parser);
|
|
7590
|
+
const doc = parser.parseDoc(html, rootComponentLoader);
|
|
7591
|
+
if (doc instanceof core$1.Component) {
|
|
7592
|
+
return doc;
|
|
7593
|
+
}
|
|
7594
|
+
const content = new core$1.Slot([
|
|
7595
|
+
core$1.ContentType.BlockComponent
|
|
7596
|
+
]);
|
|
7597
|
+
if (doc instanceof core$1.Slot) {
|
|
7598
|
+
deltaToBlock(doc.toDelta(), this).forEach(i => {
|
|
7599
|
+
content.insert(i);
|
|
7600
|
+
});
|
|
7601
|
+
}
|
|
7602
|
+
return new RootComponent(this, {
|
|
7603
|
+
content
|
|
7604
|
+
});
|
|
7605
|
+
}
|
|
7590
7606
|
}
|
|
7591
7607
|
|
|
7592
7608
|
exports.AtComponent = AtComponent;
|
package/index.tsx
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import 'reflect-metadata'
|
|
3
|
+
import { Editor, Member, Organization } from './src/public-api'
|
|
4
|
+
import { SyncConnector, YWebsocketConnector } from '@textbus/collaborate'
|
|
5
|
+
import { FileUploader } from './src/interfaces'
|
|
6
|
+
import { UserInfo } from './src/xnote-message-bus'
|
|
7
|
+
import { StaticToolbarPlugin, SuspensionToolbarPlugin } from '@textbus/xnote'
|
|
8
|
+
import { VIEW_CONTAINER } from '@textbus/platform-browser'
|
|
9
|
+
import { createRef, onMounted } from '@viewfly/core'
|
|
10
|
+
import { createApp } from '@viewfly/platform-browser'
|
|
11
|
+
import { RootComponentRef } from '@textbus/core'
|
|
12
|
+
|
|
13
|
+
const firstNameText = '王、李、张、刘、陈、杨、黄、赵、周、吴、徐、孙、马、胡、朱、郭、何、罗、高、林'.replace(/、/g, '')
|
|
14
|
+
const lastNameText = '本义既为女子所生子嗣则同一女子所生子嗣组成的亲族也可以称为姓以表示其同出于一个女性始祖的这种特殊的亲属关系这是姓的另一引申义此种亲族组织强调女性始祖则当如许多学者所推拟的其最初必形成于母系氏族社会中即夫从妻居子女属于母族世系以母方计对于这种具有血缘关系的亲属组织的名称杨希枚先生主张称为姓族典籍所记姬姓姜姓嬴姓最初应皆属母系姓族姬姜则是此种母系姓族之名号进入父系氏族社会后妻从夫居子女不再属母族而归于父族世系以父方计所以母系姓族遂转为父系姓族此后父系姓族仍然使用着母系姓族的名号其四姓在东周文献中有时是指姓族之名号如国语周语下言赐姓曰姜之姓即应理解为所赐姓族之名号即姜又如左传哀公五月昭夫人孟子卒昭公娶于吴故不书姓很明显姓在这里是指吴女所属姓族之名号即姬所谓姓族之姓与作姓族名号讲的姓是一实一名属于两种概念范畴所以会发生此种混同当如杨希枚先生所言是由于名代表实积久而以实为名于是产生姬姜之类姓之名号就是姓的概念司马迁在史记中常言姓某氏没能区别古代姓与氏之不同但他所说的姓意思即是指姓族之名号妘黄帝住姬水之滨以姬为姓司马迁在史记五帝本纪中说黄帝二十五子其得姓者十四人三语中胥臣解释说黄帝之子二十五宗其得姓者十四人为十二姓姬酉祁己滕箴任荀僖姞儇衣是也惟青阳与夷鼓同己姓后来的五帝少昊颛顼喾尧舜以及夏禹商族的祖先契周族的祖先农神后稷秦族的祖先伯益等都是黄帝的后代后稷承继姬姓他的后代建立了周朝周初周天子姬发大封诸侯时其中姬姓国个姬姓位于百家姓第位由姬姓演支出个姓占百家姓总姓姓的再演化出来的姓氏更是数不胜数了炎帝居姜水之旁以姜为姓姜姓还是今天中国的许多姓氏如吕姓谢姓齐姓高姓卢姓崔姓等的重要起源之一姜姓在当今以人口排名的中国百家姓氏中居于第位妘起源于帝喾高辛氏嬴起源于少昊金天氏;姚妫同源都是起源于帝舜;姒起源于大禹此外部落首领之子亦可得姓黄帝有二十五子得姓者十四人为姬酉祁己滕任荀葴僖姞儇依十二姓其中有四人分属二姓祝融之后为己董彭秃妘曹斟芈等八姓史称祝融八姓'
|
|
15
|
+
|
|
16
|
+
function createUserName() {
|
|
17
|
+
const firstName = firstNameText.substr(Math.floor(Math.random() * firstNameText.length), 1)
|
|
18
|
+
const lastName = lastNameText.substr(Math.floor(Math.random() * lastNameText.length), 1 + Math.floor(Math.random() * 2))
|
|
19
|
+
|
|
20
|
+
return firstName + lastName
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const username = createUserName()
|
|
24
|
+
|
|
25
|
+
function createColor() {
|
|
26
|
+
const fn = function () {
|
|
27
|
+
const s = Math.floor(Math.random() * 255).toString(16)
|
|
28
|
+
if (s.length === 2) {
|
|
29
|
+
return s
|
|
30
|
+
}
|
|
31
|
+
return '0' + s
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return `#${fn()}${fn()}${fn()}`
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const user: UserInfo = {
|
|
38
|
+
username: username,
|
|
39
|
+
color: createColor(),
|
|
40
|
+
id: Math.random().toString()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function sleep(delay: number) {
|
|
44
|
+
return new Promise<void>(resolve => {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
resolve()
|
|
47
|
+
}, delay)
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class Http extends Organization {
|
|
52
|
+
async getMembers(name: string): Promise<Member[]> {
|
|
53
|
+
await sleep(100)
|
|
54
|
+
let len = Math.floor(20 / name.length + 1)
|
|
55
|
+
|
|
56
|
+
const arr = Array.from<Member>({ length: len }).map(() => {
|
|
57
|
+
return {
|
|
58
|
+
id: 'xxx',
|
|
59
|
+
name: name + createUserName(),
|
|
60
|
+
groupName: '部门-' + createUserName(),
|
|
61
|
+
groupId: 'xxx',
|
|
62
|
+
avatar: '',
|
|
63
|
+
color: createColor()
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
if (name.length) {
|
|
68
|
+
arr.unshift({
|
|
69
|
+
id: 'xxx',
|
|
70
|
+
name: name,
|
|
71
|
+
groupName: '部门-' + createUserName(),
|
|
72
|
+
groupId: 'xxx',
|
|
73
|
+
avatar: '',
|
|
74
|
+
color: createColor()
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return Promise.resolve(arr)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
atMember(member: Member) {
|
|
82
|
+
//
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const editor = new Editor({
|
|
87
|
+
readonly: false,
|
|
88
|
+
// content: document.getElementById('article')!.innerHTML,
|
|
89
|
+
collaborateConfig: {
|
|
90
|
+
userinfo: user,
|
|
91
|
+
createConnector(yDoc): SyncConnector {
|
|
92
|
+
return new YWebsocketConnector('ws://localhost:1234', 'xnote', yDoc)
|
|
93
|
+
// return new YWebsocketConnector('wss://textbus.io/api', 'xnote', yDoc)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
// plugins: [
|
|
97
|
+
// new SuspensionToolbarPlugin()
|
|
98
|
+
// ],
|
|
99
|
+
providers: [
|
|
100
|
+
{
|
|
101
|
+
provide: Organization,
|
|
102
|
+
useValue: new Http()
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
provide: FileUploader,
|
|
106
|
+
useValue: {
|
|
107
|
+
uploadFile(type: string) {
|
|
108
|
+
console.log(type)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
function App() {
|
|
116
|
+
const editorRef = createRef<HTMLElement>()
|
|
117
|
+
const htmlRef = createRef<HTMLTextAreaElement>()
|
|
118
|
+
|
|
119
|
+
onMounted(() => {
|
|
120
|
+
editor.mount(editorRef.current!).then(() => {
|
|
121
|
+
const root = editor.get(RootComponentRef).component
|
|
122
|
+
root.changeMarker.onChange.subscribe(op => {
|
|
123
|
+
console.log(op)
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
return () => {
|
|
128
|
+
return (
|
|
129
|
+
<div>
|
|
130
|
+
<div style={{
|
|
131
|
+
display: 'flex',
|
|
132
|
+
height: '60px',
|
|
133
|
+
}}>
|
|
134
|
+
<button type="button" onClick={() => {
|
|
135
|
+
const html = editor.getHTML()
|
|
136
|
+
htmlRef.current!.value = html
|
|
137
|
+
}}>获取 HTML</button>
|
|
138
|
+
<textarea name="" id="" ref={htmlRef} cols="30" rows="10"></textarea>
|
|
139
|
+
<button type="button" onClick={() => {
|
|
140
|
+
const html = htmlRef.current!.value
|
|
141
|
+
editor.setContent(html)
|
|
142
|
+
}}>设置 HTML</button>
|
|
143
|
+
</div>
|
|
144
|
+
<div ref={editorRef}></div>
|
|
145
|
+
</div>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
createApp(<App/>).mount(document.getElementById('app')!)
|
|
151
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textbus/xnote",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A high-performance rich text editor that supports multiplayer online collaboration.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tanbo/color": "^0.1.1",
|
|
30
|
-
"@textbus/adapter-viewfly": "^4.3.
|
|
31
|
-
"@textbus/collaborate": "^4.3.
|
|
32
|
-
"@textbus/core": "^4.3.
|
|
33
|
-
"@textbus/platform-browser": "^4.3.
|
|
34
|
-
"@viewfly/core": "^1.1.
|
|
35
|
-
"@viewfly/hooks": "^1.1.
|
|
36
|
-
"@viewfly/platform-browser": "^1.1.
|
|
37
|
-
"@viewfly/scoped-css": "^1.1.
|
|
30
|
+
"@textbus/adapter-viewfly": "^4.3.1",
|
|
31
|
+
"@textbus/collaborate": "^4.3.1",
|
|
32
|
+
"@textbus/core": "^4.3.1",
|
|
33
|
+
"@textbus/platform-browser": "^4.3.1",
|
|
34
|
+
"@viewfly/core": "^1.1.2",
|
|
35
|
+
"@viewfly/hooks": "^1.1.2",
|
|
36
|
+
"@viewfly/platform-browser": "^1.1.5",
|
|
37
|
+
"@viewfly/scoped-css": "^1.1.2",
|
|
38
38
|
"highlight.js": "^11.9.0",
|
|
39
39
|
"katex": "^0.16.10",
|
|
40
40
|
"uuid": "^10.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/uuid": "^10.0.0",
|
|
48
48
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
49
49
|
"@typescript-eslint/parser": "^5.8.0",
|
|
50
|
-
"@viewfly/devtools": "^1.1.
|
|
50
|
+
"@viewfly/devtools": "^1.1.4",
|
|
51
51
|
"autoprefixer": "^10.4.0",
|
|
52
52
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
53
53
|
"core-js": "^3.20.1",
|