@textbus/xnote 0.0.1-alpha.4 → 0.0.1-alpha.41

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.
Files changed (40) hide show
  1. package/README.md +26 -1
  2. package/bundles/components/_api.d.ts +2 -0
  3. package/bundles/components/dropdown/dropdown-menu.d.ts +4 -1
  4. package/bundles/components/dropdown/dropdown.d.ts +4 -1
  5. package/bundles/components/keymap/keymap.d.ts +5 -0
  6. package/bundles/components/menu-heading/menu-heading.d.ts +2 -0
  7. package/bundles/components/menu-item/menu-item.d.ts +2 -1
  8. package/bundles/components/popup/popup.d.ts +1 -1
  9. package/bundles/editor.d.ts +13 -6
  10. package/bundles/fonts/textbus.svg +3 -32
  11. package/bundles/fonts/textbus.ttf +0 -0
  12. package/bundles/fonts/textbus.woff +0 -0
  13. package/bundles/index.css +2 -2
  14. package/bundles/index.esm.css +2 -2
  15. package/bundles/index.esm.js +1912 -1076
  16. package/bundles/index.js +1924 -1072
  17. package/bundles/interfaces.d.ts +3 -0
  18. package/bundles/plugins/_api.d.ts +1 -0
  19. package/bundles/plugins/_common/attr.tool.d.ts +2 -2
  20. package/bundles/plugins/_common/color.tool.d.ts +2 -2
  21. package/bundles/plugins/left-toolbar/insert-tool.d.ts +5 -2
  22. package/bundles/plugins/link-jump/link-jump.d.ts +4 -0
  23. package/bundles/public-api.d.ts +1 -0
  24. package/bundles/services/editor.service.d.ts +4 -0
  25. package/bundles/textbus/components/SlotRender.d.ts +14 -0
  26. package/bundles/textbus/components/_api.d.ts +3 -0
  27. package/bundles/textbus/components/at/at-component.view.d.ts +6 -0
  28. package/bundles/textbus/components/at/at.component.d.ts +34 -0
  29. package/bundles/textbus/components/blockqoute/blockquote.component.d.ts +3 -1
  30. package/bundles/textbus/components/katex/katex-editor.d.ts +7 -0
  31. package/bundles/textbus/components/katex/katex.component.d.ts +15 -0
  32. package/bundles/textbus/components/list/list.component.d.ts +2 -0
  33. package/bundles/textbus/components/root/root.component.d.ts +0 -1
  34. package/bundles/textbus/components/source-code/source-code.component.d.ts +2 -1
  35. package/bundles/textbus/components/table/components/resize-column.d.ts +2 -1
  36. package/bundles/textbus/components/table/components/scroll.d.ts +1 -2
  37. package/bundles/textbus/components/table/components/top-bar.d.ts +2 -2
  38. package/bundles/textbus/components/table/table-selection-awareness-delegate.d.ts +15 -0
  39. package/bundles/textbus/components/table/table.component.d.ts +0 -1
  40. package/package.json +36 -12
@@ -0,0 +1,3 @@
1
+ export declare abstract class FileUploader {
2
+ abstract uploadFile(type: string): string | Promise<string>;
3
+ }
@@ -4,5 +4,6 @@ export * from './hooks/block-transform';
4
4
  export * from './left-toolbar/insert-tool';
5
5
  export * from './left-toolbar/left-toolbar.plugin';
6
6
  export * from './left-toolbar/left-toolbar';
7
+ export * from './link-jump/link-jump';
7
8
  export * from './toolbar/toolbar.plugin';
8
9
  export * from './toolbar/toolbar';
@@ -1,11 +1,11 @@
1
1
  import { Props } from '@viewfly/core';
2
+ import { Slot } from '@textbus/core';
2
3
  import { HTMLAttributes } from '@viewfly/platform-browser';
3
4
  import { DropdownProps } from '../../components/dropdown/dropdown';
4
5
  export interface AttrToolProps extends Props {
5
6
  abreast?: DropdownProps['abreast'];
6
7
  style?: HTMLAttributes<HTMLElement>['style'];
7
- queryBefore?(): void;
8
- queryAfter?(): void;
8
+ slot?: Slot | null;
9
9
  applyBefore?(): void;
10
10
  }
11
11
  export declare function AttrTool(props: AttrToolProps): () => any;
@@ -1,11 +1,11 @@
1
1
  import { Props } from '@viewfly/core';
2
+ import { Slot } from '@textbus/core';
2
3
  import { HTMLAttributes } from '@viewfly/platform-browser';
3
4
  import { DropdownProps } from '../../components/dropdown/dropdown';
4
5
  export interface ColorToolProps extends Props {
5
6
  abreast?: DropdownProps['abreast'];
6
7
  style?: HTMLAttributes<HTMLElement>['style'];
7
- queryBefore?(): void;
8
- queryAfter?(): void;
8
+ slot?: Slot | null;
9
9
  applyBefore?(): void;
10
10
  }
11
11
  export declare function ColorTool(props: ColorToolProps): () => any;
@@ -1,4 +1,7 @@
1
1
  import { Slot } from '@textbus/core';
2
- export declare function InsertTool(props: {
2
+ export interface InsertToolProps {
3
3
  slot: Slot | null;
4
- }): () => any;
4
+ hideTitle?: boolean;
5
+ replace?: boolean;
6
+ }
7
+ export declare function InsertTool(props: InsertToolProps): () => any;
@@ -0,0 +1,4 @@
1
+ export declare function LinkJump(): {
2
+ $portalHost: HTMLElement;
3
+ $render: () => import("@viewfly/core").ViewFlyNode<string | import("@viewfly/core").ComponentSetup<any>>;
4
+ };
@@ -2,4 +2,5 @@ export * from './components/_api';
2
2
  export * from './plugins/_api';
3
3
  export * from './services/_api';
4
4
  export * from './textbus/_api';
5
+ export * from './interfaces';
5
6
  export * from './editor';
@@ -1,3 +1,7 @@
1
+ import { Subject } from '@textbus/core';
1
2
  export declare class EditorService {
2
3
  hideInlineToolbar: boolean;
4
+ canShowLeftToolbar: boolean;
5
+ onLeftToolbarCanVisibleChange: Subject<void>;
6
+ changeLeftToolbarVisible(b: boolean): void;
3
7
  }
@@ -0,0 +1,14 @@
1
+ import { Slot } from '@textbus/core';
2
+ import { DynamicRef } from '@viewfly/core';
3
+ import { HTMLAttributes } from '@viewfly/platform-browser';
4
+ interface Props extends HTMLAttributes<unknown> {
5
+ slot: Slot;
6
+ /** 默认值为 div */
7
+ tag?: string;
8
+ class?: string;
9
+ renderEnv?: boolean;
10
+ elRef?: DynamicRef<HTMLElement>;
11
+ elKey?: number | string;
12
+ }
13
+ export declare function SlotRender(props: Props): () => any;
14
+ export {};
@@ -1,6 +1,9 @@
1
+ export * from './at/at.component';
2
+ export * from './at/at-component.view';
1
3
  export * from './blockqoute/blockquote.component';
2
4
  export * from './highlight-box/highlight-box.component';
3
5
  export * from './image/image.component';
6
+ export * from './katex/katex.component';
4
7
  export * from './list/list.component';
5
8
  export * from './paragraph/paragraph.component';
6
9
  export * from './root/root.component';
@@ -0,0 +1,6 @@
1
+ import { ViewComponentProps } from '@textbus/adapter-viewfly';
2
+ import { ComponentLoader } from '@textbus/platform-browser';
3
+ import { AtComponent } from './at.component';
4
+ import './at.component.scss';
5
+ export declare function AtComponentView(props: ViewComponentProps<AtComponent>): () => any;
6
+ export declare const atComponentLoader: ComponentLoader;
@@ -0,0 +1,34 @@
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Subject, Textbus } from '@textbus/core';
2
+ export interface Member {
3
+ /** 头像 url */
4
+ avatar: string;
5
+ /** 成员名称 */
6
+ name: string;
7
+ /** 成员 id */
8
+ id: string;
9
+ /** 成员所属群组名 */
10
+ groupName: string;
11
+ /** 成员所属群组 id */
12
+ groupId: string;
13
+ /** 成员背景色 */
14
+ color?: string;
15
+ }
16
+ export declare abstract class Organization {
17
+ abstract getMembers(name?: string): Promise<Member[]>;
18
+ abstract getMemberById(id: string): Promise<Member | null>;
19
+ }
20
+ export interface AtComponentState {
21
+ userInfo?: Member;
22
+ slot?: Slot;
23
+ }
24
+ export declare function registerAtShortcut(textbus: Textbus): void;
25
+ export declare class AtComponent extends Component<AtComponentState> {
26
+ static componentName: string;
27
+ static type: ContentType;
28
+ static fromJSON(textbus: Textbus, { slot: slotState, userInfo }: ComponentStateLiteral<AtComponentState>): AtComponent;
29
+ focus: Subject<boolean>;
30
+ members: import("@viewfly/core").Signal<Member[]>;
31
+ selectedIndex: import("@viewfly/core").Signal<number>;
32
+ constructor(textbus: any, state?: AtComponentState);
33
+ setup(): void;
34
+ }
@@ -1,4 +1,4 @@
1
- import { Component, ContentType, Slot, ComponentStateLiteral, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
2
2
  import { ComponentLoader } from '@textbus/platform-browser';
3
3
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
4
4
  import './blockquote.component.scss';
@@ -13,5 +13,7 @@ export declare class BlockquoteComponent extends Component<BlockquoteComponentSt
13
13
  constructor(textbus: Textbus, state?: BlockquoteComponentState);
14
14
  setup(): void;
15
15
  }
16
+ export declare function toBlockquote(textbus: Textbus): void;
17
+ export declare function registerBlockquoteShortcut(textbus: Textbus): void;
16
18
  export declare function BlockquoteView(props: ViewComponentProps<BlockquoteComponent>): () => any;
17
19
  export declare const blockquoteComponentLoader: ComponentLoader;
@@ -0,0 +1,7 @@
1
+ import { Subject, Textbus } from '@textbus/core';
2
+ export declare class KatexEditor extends Textbus {
3
+ host: HTMLElement;
4
+ onValueChange: Subject<string>;
5
+ constructor();
6
+ mount(host: HTMLElement, code: string): Promise<this>;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { Component, ComponentStateLiteral, ContentType, Textbus } from '@textbus/core';
2
+ import { ViewComponentProps } from '@textbus/adapter-viewfly';
3
+ import { ComponentLoader } from '@textbus/platform-browser';
4
+ import './katex.component.scss';
5
+ export interface KatexComponentState {
6
+ text: string;
7
+ }
8
+ export declare class KatexComponent extends Component<KatexComponentState> {
9
+ static componentName: string;
10
+ static type: ContentType;
11
+ static fromJSON(textbus: Textbus, state: ComponentStateLiteral<KatexComponentState>): KatexComponent;
12
+ constructor(textbus: Textbus, state?: KatexComponentState);
13
+ }
14
+ export declare function KatexComponentView(props: ViewComponentProps<KatexComponent>): () => any;
15
+ export declare const katexComponentLoader: ComponentLoader;
@@ -7,6 +7,8 @@ export interface ListComponentState {
7
7
  slot: Slot;
8
8
  reorder: boolean;
9
9
  }
10
+ export declare function toList(textbus: Textbus, type: 'OrderedList' | 'UnorderedList'): void;
11
+ export declare function registerListShortcut(textbus: Textbus): void;
10
12
  export declare class ListComponent extends Component<ListComponentState> {
11
13
  static componentName: string;
12
14
  static type: ContentType;
@@ -3,7 +3,6 @@ import { ComponentLoader } from '@textbus/platform-browser';
3
3
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
4
4
  import './root.component.scss';
5
5
  export interface RootComponentState {
6
- heading: Slot;
7
6
  content: Slot;
8
7
  }
9
8
  export declare class RootComponent extends Component<RootComponentState> {
@@ -1,4 +1,4 @@
1
- import { ComponentStateLiteral, BehaviorSubject, Component, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
1
+ import { BehaviorSubject, Component, ComponentStateLiteral, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
2
2
  import { ComponentLoader } from '@textbus/platform-browser';
3
3
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
4
4
  import './source-code.component.scss';
@@ -28,6 +28,7 @@ export declare class SourceCodeComponent extends Component<SourceCodeComponentSt
28
28
  static zenCoding: ZenCodingGrammarInterceptor<SourceCodeComponentState>;
29
29
  focus: BehaviorSubject<boolean>;
30
30
  setup(): void;
31
+ removeSlot(slot: Slot): boolean;
31
32
  cancelEmphasize: () => void;
32
33
  emphasize: () => void;
33
34
  }
@@ -1,8 +1,9 @@
1
- import { StaticRef } from '@viewfly/core';
1
+ import { Signal, StaticRef } from '@viewfly/core';
2
2
  import { TableComponent } from '../table.component';
3
3
  export interface ResizeColumnProps {
4
4
  tableRef: StaticRef<HTMLTableElement>;
5
5
  component: TableComponent;
6
+ layoutWidth: Signal<number[]>;
6
7
  onActiveStateChange(isActive: boolean): void;
7
8
  }
8
9
  export declare function ResizeColumn(props: ResizeColumnProps): () => any;
@@ -1,6 +1,5 @@
1
- import { Props, Signal, StaticRef } from '@viewfly/core';
1
+ import { Props, Signal } from '@viewfly/core';
2
2
  export interface ScrollProps extends Props {
3
3
  isFocus: Signal<boolean>;
4
- scrollRef: StaticRef<HTMLDivElement>;
5
4
  }
6
5
  export declare function Scroll(props: ScrollProps): () => any;
@@ -1,8 +1,8 @@
1
- import { Signal, StaticRef } from '@viewfly/core';
1
+ import { Signal } from '@viewfly/core';
2
2
  import { TableComponent } from '../table.component';
3
3
  export interface TopBarProps {
4
4
  isFocus: Signal<boolean>;
5
5
  component: TableComponent;
6
- scrollRef: StaticRef<HTMLDivElement>;
6
+ layoutWidth: Signal<number[]>;
7
7
  }
8
8
  export declare function TopBar(props: TopBarProps): () => any;
@@ -0,0 +1,15 @@
1
+ import { CollaborateSelectionAwarenessDelegate, DomAdapter } from '@textbus/platform-browser';
2
+ import { AbstractSelection, Slot, Selection } from '@textbus/core';
3
+ import { TableComponent } from './table.component';
4
+ export declare function findFocusCell(table: TableComponent, slot: Slot): Slot | null;
5
+ export declare class TableSelectionAwarenessDelegate extends CollaborateSelectionAwarenessDelegate {
6
+ private domAdapter;
7
+ private selection;
8
+ constructor(domAdapter: DomAdapter, selection: Selection);
9
+ getRects(abstractSelection: AbstractSelection): false | {
10
+ left: number;
11
+ top: number;
12
+ width: number;
13
+ height: number;
14
+ }[];
15
+ }
@@ -22,7 +22,6 @@ export declare class TableComponent extends Component<TableComponentState> {
22
22
  focus: Subject<boolean>;
23
23
  tableSelection: import("@viewfly/core").Signal<TableSelection | null>;
24
24
  setup(): void;
25
- afterContentCheck(): void;
26
25
  deleteColumn(index: number): void;
27
26
  deleteRow(index: number): void;
28
27
  insertColumn(index: number): void;
package/package.json CHANGED
@@ -1,10 +1,22 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.0.1-alpha.4",
4
- "description": "Viewfly project.",
3
+ "version": "0.0.1-alpha.41",
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",
7
7
  "types": "./bundles/public-api.d.ts",
8
+ "keywords": [
9
+ "textbus",
10
+ "xnote",
11
+ "富文本编辑器",
12
+ "wysiwyg",
13
+ "wysiwyg editor",
14
+ "rich text editor",
15
+ "editor",
16
+ "html editor",
17
+ "web editor",
18
+ "collaborate"
19
+ ],
8
20
  "scripts": {
9
21
  "start": "webpack-dev-server",
10
22
  "serve": "npx y-websocket HOST=localhost PORT=1234 ",
@@ -14,16 +26,17 @@
14
26
  "test": "echo \"Error: no test specified\" && exit 1"
15
27
  },
16
28
  "dependencies": {
17
- "@textbus/adapter-viewfly": "^4.0.0-alpha.42",
18
- "@textbus/collaborate": "^4.0.0-alpha.42",
19
- "@textbus/core": "^4.0.0-alpha.42",
20
- "@textbus/platform-browser": "^4.0.0-alpha.42",
21
- "@viewfly/core": "^1.0.0-alpha.1",
22
- "@viewfly/hooks": "^1.0.0-alpha.1",
23
- "@viewfly/platform-browser": "^1.0.0-alpha.1",
24
- "@viewfly/scoped-css": "^1.0.0-alpha.1",
29
+ "@tanbo/color": "^0.1.1",
30
+ "@textbus/adapter-viewfly": "^4.0.0-alpha.67",
31
+ "@textbus/collaborate": "^4.0.0-alpha.66",
32
+ "@textbus/core": "^4.0.0-alpha.66",
33
+ "@textbus/platform-browser": "^4.0.0-alpha.66",
34
+ "@viewfly/core": "^1.0.0-alpha.17",
35
+ "@viewfly/hooks": "^1.0.0-alpha.17",
36
+ "@viewfly/platform-browser": "^1.0.0-alpha.17",
37
+ "@viewfly/scoped-css": "^1.0.0-alpha.17",
25
38
  "highlight.js": "^11.9.0",
26
- "reflect-metadata": "^0.1.13"
39
+ "katex": "^0.16.10"
27
40
  },
28
41
  "devDependencies": {
29
42
  "@babel/core": "^7.16.5",
@@ -32,7 +45,7 @@
32
45
  "@types/jest": "^29.5.2",
33
46
  "@typescript-eslint/eslint-plugin": "^5.8.0",
34
47
  "@typescript-eslint/parser": "^5.8.0",
35
- "@viewfly/devtools": "^0.7.1",
48
+ "@viewfly/devtools": "^0.7.2",
36
49
  "autoprefixer": "^10.4.0",
37
50
  "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
38
51
  "core-js": "^3.20.1",
@@ -65,5 +78,16 @@
65
78
  "webpack": "^5.65.0",
66
79
  "webpack-cli": "^4.10.0",
67
80
  "webpack-dev-server": "^4.7.1"
81
+ },
82
+ "author": {
83
+ "name": "Tanbo",
84
+ "email": "tanbohb@qq.com"
85
+ },
86
+ "bugs": {
87
+ "url": "https://github.com/textbus/xnote.git/issues"
88
+ },
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "https://github.com/textbus/xnote.git"
68
92
  }
69
93
  }