@textbus/xnote 0.0.2 → 0.0.3

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.
@@ -2,14 +2,14 @@ import { jsxs, jsx, Fragment } from '@viewfly/core/jsx-runtime';
2
2
  import { withScopedCSS } from '@viewfly/scoped-css';
3
3
  import { Injectable, InjectFlags, Injector, inject, createSignal, onUnmounted, createRef, withAnnotation, onUpdated, onMounted, InjectionToken, getCurrentInstance, ReflectiveInjector, createDynamicRef, jsx as jsx$1, viewfly, watch } from '@viewfly/core';
4
4
  import { Subject, Selection, fromEvent, Subscription, Attribute, Keyboard, Commander, Controller, useContext, onBreak, onContentInsert, ContentType, merge, createVNode, Slot, Component, Registry, Query, QueryStateType, BehaviorSubject, onSlotApplyFormat, onSlotSetAttribute, onPaste, onFocus, onBlur, useDynamicShortcut, VTextNode, onFocusIn, onFocusOut, onDestroy, onGetRanges, Formatter, onParentSlotUpdated, Textbus, RootComponentRef, filter, map, distinctUntilChanged, sampleTime, debounceTime, throttleTime, delay, onContentInserted, onContentDeleted, switchMap, fromPromise, onCompositionStart } from '@textbus/core';
5
- import { VIEW_CONTAINER, isMac, DomAdapter, Input, SelectionBridge, BrowserModule, VIEW_DOCUMENT, CollaborateSelectionAwarenessDelegate, isMobileBrowser, Parser } from '@textbus/platform-browser';
5
+ import { VIEW_CONTAINER, isMac, DomAdapter, Input, SelectionBridge, BrowserModule, VIEW_DOCUMENT, CollaborateSelectionAwarenessDelegate, isMobileBrowser, CollaborateCursor, Parser } from '@textbus/platform-browser';
6
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
9
  import Katex from 'katex';
10
10
  import { ViewflyAdapter, ViewflyVDomAdapter } from '@textbus/adapter-viewfly';
11
11
  import { any2Hsl, hsl2Rgb } from '@tanbo/color';
12
- import { CollaborateModule } from '@textbus/collaborate';
12
+ import { CollaborateModule, UserActivity } from '@textbus/collaborate';
13
13
 
14
14
  var scopedId$n = "vf-d94b56";
15
15
 
@@ -5746,7 +5746,19 @@ class Editor extends Textbus {
5746
5746
  ], plugins: [
5747
5747
  new LeftToolbarPlugin(),
5748
5748
  new ToolbarPlugin(),
5749
- ], onAfterStartup(textbus) {
5749
+ ], setup(textbus) {
5750
+ if (editorConfig.collaborateConfig) {
5751
+ const activity = textbus.get(UserActivity);
5752
+ const collabCursor = textbus.get(CollaborateCursor);
5753
+ const sub = activity.onStateChange.subscribe(ev => {
5754
+ collabCursor.draw(ev);
5755
+ });
5756
+ return () => {
5757
+ sub.unsubscribe();
5758
+ };
5759
+ }
5760
+ },
5761
+ onAfterStartup(textbus) {
5750
5762
  registerBoldShortcut(textbus);
5751
5763
  registerCodeShortcut(textbus);
5752
5764
  registerItalicShortcut(textbus);
package/bundles/index.js CHANGED
@@ -5748,7 +5748,19 @@ class Editor extends core$1.Textbus {
5748
5748
  ], plugins: [
5749
5749
  new LeftToolbarPlugin(),
5750
5750
  new ToolbarPlugin(),
5751
- ], onAfterStartup(textbus) {
5751
+ ], setup(textbus) {
5752
+ if (editorConfig.collaborateConfig) {
5753
+ const activity = textbus.get(collaborate.UserActivity);
5754
+ const collabCursor = textbus.get(platformBrowser.CollaborateCursor);
5755
+ const sub = activity.onStateChange.subscribe(ev => {
5756
+ collabCursor.draw(ev);
5757
+ });
5758
+ return () => {
5759
+ sub.unsubscribe();
5760
+ };
5761
+ }
5762
+ },
5763
+ onAfterStartup(textbus) {
5752
5764
  registerBoldShortcut(textbus);
5753
5765
  registerCodeShortcut(textbus);
5754
5766
  registerItalicShortcut(textbus);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
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,10 +27,10 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@tanbo/color": "^0.1.1",
30
- "@textbus/adapter-viewfly": "^4.0.0",
31
- "@textbus/collaborate": "^4.0.0",
32
- "@textbus/core": "^4.0.0",
33
- "@textbus/platform-browser": "^4.0.0",
30
+ "@textbus/adapter-viewfly": "^4.0.2",
31
+ "@textbus/collaborate": "^4.0.2",
32
+ "@textbus/core": "^4.0.1",
33
+ "@textbus/platform-browser": "^4.0.2",
34
34
  "@viewfly/core": "^1.0.0-alpha.22",
35
35
  "@viewfly/hooks": "^1.0.0-alpha.22",
36
36
  "@viewfly/platform-browser": "^1.0.0-alpha.22",