@fileverse-dev/ddoc 2.1.5 → 2.1.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.es.js CHANGED
@@ -149244,14 +149244,9 @@ const LWt = ({
149244
149244
  ..._ie(() => null, "", ""),
149245
149245
  Vie,
149246
149246
  qie,
149247
- qte.configure({
149248
- document: o
149249
- })
149247
+ qte.configure({ document: o })
149250
149248
  ];
149251
- return { editor: new Mq({
149252
- extensions: l,
149253
- autofocus: !1
149254
- }), ydoc: o };
149249
+ return { editor: new Mq({ extensions: l, autofocus: !1 }), ydoc: o };
149255
149250
  }, e = (o) => Array.isArray(o) || typeof o == "string" && !Jie(o), n = (o, l) => {
149256
149251
  const c = o.map((u) => Gd(u));
149257
149252
  kf(l, N4(c));
@@ -149261,17 +149256,20 @@ const LWt = ({
149261
149256
  }, i = (o, l, c) => {
149262
149257
  if (!l) throw new Error("cannot set content without Editor");
149263
149258
  e(o) ? Array.isArray(o) ? n(o, c) : kf(c, Gd(o)) : l.commands.setContent(
149264
- Qie({
149265
- data: o
149266
- })
149259
+ Qie({ data: o })
149267
149260
  );
149268
149261
  };
149269
149262
  return {
149270
149263
  setContent: i,
149271
149264
  getEditor: t,
149272
- convertJSONContentToYjsEncodedString: (o) => {
149273
- const { editor: l, ydoc: c } = t();
149274
- return i(o, l, c), Y4(tg(c));
149265
+ getYjsConvertor: () => {
149266
+ const { editor: o, ydoc: l } = t();
149267
+ return {
149268
+ convertJSONContentToYjsEncodedString: (c) => (i(c, o, l), Y4(tg(l))),
149269
+ cleanup: () => {
149270
+ o && o.destroy(), l && l.destroy();
149271
+ }
149272
+ };
149275
149273
  },
149276
149274
  downloadContentAsMd: (o, l) => {
149277
149275
  const { editor: c, ydoc: u } = t();
@@ -7,7 +7,10 @@ export declare const useHeadlessEditor: () => {
7
7
  editor: Editor;
8
8
  ydoc: Y.Doc;
9
9
  };
10
- convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
10
+ getYjsConvertor: () => {
11
+ convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
12
+ cleanup: () => void;
13
+ };
11
14
  downloadContentAsMd: (content: string | string[] | JSONContent, title: string) => void;
12
15
  mergeYjsUpdates: (contents: string[]) => string;
13
16
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "2.1.5",
5
+ "version": "2.1.6",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {