@kopexa/tiptap 17.8.5 → 17.8.6

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/dist/index.js CHANGED
@@ -4038,6 +4038,7 @@ var useCreateEditor = ({
4038
4038
  disabled
4039
4039
  })
4040
4040
  );
4041
+ const { onCreate: userOnCreate, ...restOptions } = options;
4041
4042
  const editor = (0, import_react32.useEditor)({
4042
4043
  editorProps: {
4043
4044
  attributes: {
@@ -4055,7 +4056,29 @@ var useCreateEditor = ({
4055
4056
  onChange == null ? void 0 : onChange(editor2.getJSON());
4056
4057
  },
4057
4058
  content: safeParseContent(content),
4058
- ...options
4059
+ // Seed empty collaborative documents with initial content.
4060
+ // When the Collaboration extension is active, TipTap ignores the `content`
4061
+ // prop entirely — content comes from the Y.Doc. If the Hocuspocus server
4062
+ // delivers an empty doc (e.g. a freshly created version), we populate it
4063
+ // with the `content` prop once after the initial sync.
4064
+ onCreate: (ctx) => {
4065
+ if (collaboration) {
4066
+ const provider = collaboration.provider;
4067
+ if (provider && !provider.isSynced) {
4068
+ provider.on("synced", () => {
4069
+ setTimeout(() => {
4070
+ if (ctx.editor.isEmpty && content) {
4071
+ ctx.editor.commands.setContent(safeParseContent(content));
4072
+ }
4073
+ }, 0);
4074
+ });
4075
+ } else if (ctx.editor.isEmpty && content) {
4076
+ ctx.editor.commands.setContent(safeParseContent(content));
4077
+ }
4078
+ }
4079
+ userOnCreate == null ? void 0 : userOnCreate(ctx);
4080
+ },
4081
+ ...restOptions
4059
4082
  });
4060
4083
  (0, import_react33.useEffect)(() => {
4061
4084
  if (editor && editor.isEditable !== editable) {
package/dist/index.mjs CHANGED
@@ -4036,6 +4036,7 @@ var useCreateEditor = ({
4036
4036
  disabled
4037
4037
  })
4038
4038
  );
4039
+ const { onCreate: userOnCreate, ...restOptions } = options;
4039
4040
  const editor = useEditor({
4040
4041
  editorProps: {
4041
4042
  attributes: {
@@ -4053,7 +4054,29 @@ var useCreateEditor = ({
4053
4054
  onChange == null ? void 0 : onChange(editor2.getJSON());
4054
4055
  },
4055
4056
  content: safeParseContent(content),
4056
- ...options
4057
+ // Seed empty collaborative documents with initial content.
4058
+ // When the Collaboration extension is active, TipTap ignores the `content`
4059
+ // prop entirely — content comes from the Y.Doc. If the Hocuspocus server
4060
+ // delivers an empty doc (e.g. a freshly created version), we populate it
4061
+ // with the `content` prop once after the initial sync.
4062
+ onCreate: (ctx) => {
4063
+ if (collaboration) {
4064
+ const provider = collaboration.provider;
4065
+ if (provider && !provider.isSynced) {
4066
+ provider.on("synced", () => {
4067
+ setTimeout(() => {
4068
+ if (ctx.editor.isEmpty && content) {
4069
+ ctx.editor.commands.setContent(safeParseContent(content));
4070
+ }
4071
+ }, 0);
4072
+ });
4073
+ } else if (ctx.editor.isEmpty && content) {
4074
+ ctx.editor.commands.setContent(safeParseContent(content));
4075
+ }
4076
+ }
4077
+ userOnCreate == null ? void 0 : userOnCreate(ctx);
4078
+ },
4079
+ ...restOptions
4057
4080
  });
4058
4081
  useEffect14(() => {
4059
4082
  if (editor && editor.isEditable !== editable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/tiptap",
3
- "version": "17.8.5",
3
+ "version": "17.8.6",
4
4
  "description": "our tiptap components",
5
5
  "keywords": [
6
6
  "tiptap"
@@ -28,7 +28,7 @@
28
28
  "motion": ">=12.23.6",
29
29
  "react": ">=19.0.0-rc.0",
30
30
  "react-dom": ">=19.0.0-rc.0",
31
- "@kopexa/theme": "17.24.2"
31
+ "@kopexa/theme": "17.24.3"
32
32
  },
33
33
  "dependencies": {
34
34
  "@floating-ui/dom": "^1.7.4",
@@ -61,34 +61,34 @@
61
61
  "dompurify": "^3.3.1",
62
62
  "katex": "^0.16.33",
63
63
  "jsx-dom-cjs": "^8.1.6",
64
- "markdown-it": "^14.1.0",
64
+ "markdown-it": "^14.1.1",
65
65
  "react-hotkeys-hook": "^5.2.4",
66
66
  "react-intl": "^7.1.14",
67
67
  "y-indexeddb": "^9.0.12",
68
68
  "yjs": "^13.6.0",
69
- "@kopexa/button": "17.0.54",
70
- "@kopexa/callout": "17.0.54",
71
- "@kopexa/dialog": "17.2.19",
72
- "@kopexa/dropdown-menu": "17.0.54",
73
- "@kopexa/editor-utils": "17.1.5",
74
- "@kopexa/chip": "17.1.51",
69
+ "@kopexa/button": "17.0.55",
70
+ "@kopexa/chip": "17.1.52",
71
+ "@kopexa/callout": "17.0.55",
72
+ "@kopexa/dialog": "17.2.20",
73
+ "@kopexa/dropdown-menu": "17.0.55",
74
+ "@kopexa/extension-code": "17.0.55",
75
75
  "@kopexa/extension-pages": "17.0.45",
76
- "@kopexa/extension-code": "17.0.54",
77
- "@kopexa/extension-controlref": "17.1.36",
78
- "@kopexa/extension-table": "17.1.6",
79
- "@kopexa/input": "17.0.54",
80
- "@kopexa/label": "17.0.54",
81
- "@kopexa/popover": "17.2.19",
82
- "@kopexa/select": "17.2.19",
83
- "@kopexa/icons": "17.7.19",
84
- "@kopexa/switch": "17.2.19",
85
- "@kopexa/react-utils": "17.0.54",
86
- "@kopexa/separator": "17.0.54",
87
- "@kopexa/shared-utils": "17.0.54",
88
- "@kopexa/toolbar": "17.2.19",
89
- "@kopexa/use-composed-ref": "17.0.54",
90
- "@kopexa/use-is-mobile": "17.0.54",
91
- "@kopexa/tabs": "17.0.54"
76
+ "@kopexa/extension-controlref": "17.1.37",
77
+ "@kopexa/extension-table": "17.1.7",
78
+ "@kopexa/icons": "17.7.20",
79
+ "@kopexa/popover": "17.2.20",
80
+ "@kopexa/editor-utils": "17.1.6",
81
+ "@kopexa/input": "17.0.55",
82
+ "@kopexa/label": "17.0.55",
83
+ "@kopexa/select": "17.2.20",
84
+ "@kopexa/switch": "17.2.20",
85
+ "@kopexa/react-utils": "17.0.55",
86
+ "@kopexa/shared-utils": "17.0.55",
87
+ "@kopexa/separator": "17.0.55",
88
+ "@kopexa/tabs": "17.0.55",
89
+ "@kopexa/use-is-mobile": "17.0.55",
90
+ "@kopexa/use-composed-ref": "17.0.55",
91
+ "@kopexa/toolbar": "17.2.20"
92
92
  },
93
93
  "clean-package": "../../../clean-package.config.json",
94
94
  "module": "dist/index.mjs",