solid-tiptap 0.4.0 → 0.5.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/LICENSE +20 -20
- package/README.md +8 -2
- package/dist/cjs/development/index.cjs +3 -15
- package/dist/cjs/development/index.cjs.map +1 -1
- package/dist/cjs/production/index.cjs +1 -1
- package/dist/esm/development/index.mjs +3 -18
- package/dist/esm/development/index.mjs.map +1 -1
- package/dist/esm/production/index.mjs +1 -1
- package/dist/types/Editor.d.ts +2 -2
- package/package.json +12 -10
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Alexis Munsayac
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> SolidJS bindings for [tiptap](https://www.tiptap.dev/)
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/solid-tiptap) [](https://github.com/airbnb/javascript)[](https://codesandbox.io/s/github/LXSMNSYC/solid-tiptap/tree/main/examples/simple-example)
|
|
5
|
+
[](https://www.npmjs.com/package/solid-tiptap) [](https://github.com/airbnb/javascript) [](https://codesandbox.io/s/github/LXSMNSYC/solid-tiptap/tree/main/examples/simple-example)
|
|
6
|
+
|
|
7
|
+

|
|
6
8
|
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
yarn add @tiptap/core solid-tiptap
|
|
12
|
+
yarn add @tiptap/core @tiptap/pm solid-tiptap
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
## Usage
|
|
@@ -146,6 +148,10 @@ const editor = createTiptapEditor(() => ({ ... }));
|
|
|
146
148
|
</Show>
|
|
147
149
|
```
|
|
148
150
|
|
|
151
|
+
## Sponsors
|
|
152
|
+
|
|
153
|
+

|
|
154
|
+
|
|
149
155
|
## License
|
|
150
156
|
|
|
151
157
|
MIT © [lxsmnsyc](https://github.com/lxsmnsyc)
|
|
@@ -2,21 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
6
|
var __export = (target, all) => {
|
|
21
7
|
for (var name in all)
|
|
22
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -74,7 +60,9 @@ function createEditorTransaction(instance, read) {
|
|
|
74
60
|
function useEditor(props) {
|
|
75
61
|
const [signal, setSignal] = (0, import_solid_js.createSignal)();
|
|
76
62
|
(0, import_solid_js.createEffect)(() => {
|
|
77
|
-
const instance = new import_core.Editor(
|
|
63
|
+
const instance = new import_core.Editor({
|
|
64
|
+
...props()
|
|
65
|
+
});
|
|
78
66
|
(0, import_solid_js.onCleanup)(() => {
|
|
79
67
|
instance.destroy();
|
|
80
68
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/Editor.tsx"],
|
|
4
4
|
"sourcesContent": ["export {\n default as useEditor,\n default as createEditor,\n default as useTiptapEditor,\n default as createTiptapEditor,\n UseEditorOptions,\n EditorRef,\n createEditorTransaction,\n useEditorCharacterCount,\n useEditorHTML,\n useEditorIsActive,\n useEditorIsEditable,\n useEditorIsEmpty,\n useEditorIsFocused,\n useEditorJSON,\n} from './Editor';\n", "import {\n createEffect,\n createSignal,\n onCleanup,\n} from 'solid-js';\nimport {\n Editor,\n EditorOptions,\n} from '@tiptap/core';\n\nexport type EditorRef = Editor | ((editor: Editor) => void);\n\nexport type BaseEditorOptions = Omit<Partial<EditorOptions>, 'element'>;\n\nexport interface UseEditorOptions<T extends HTMLElement> extends BaseEditorOptions {\n element: T;\n}\n\nexport function createEditorTransaction<T, V extends Editor | undefined>(\n instance: () => V,\n read: (value: V) => T,\n): () => T {\n const [signal, setSignal] = createSignal([]);\n\n function forceUpdate() {\n setSignal([]);\n }\n\n createEffect(() => {\n const editor = instance();\n if (editor) {\n editor.on('transaction', forceUpdate);\n onCleanup(() => {\n editor.off('transaction', forceUpdate);\n });\n }\n });\n\n return () => {\n signal();\n return read(instance());\n };\n}\n\nexport default function useEditor<T extends HTMLElement>(\n props: () => UseEditorOptions<T>,\n): () => Editor | undefined {\n const [signal, setSignal] = createSignal<Editor>();\n\n createEffect(() => {\n const instance = new Editor({\n ...props(),\n });\n\n onCleanup(() => {\n instance.destroy();\n });\n\n setSignal(instance);\n });\n\n return signal;\n}\n\nexport function useEditorHTML<V extends Editor | undefined>(\n editor: () => V,\n): () => string | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getHTML());\n}\n\nexport function useEditorJSON<V extends Editor | undefined, R extends Record<string, any>>(\n editor: () => V,\n): () => R | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getJSON() as R);\n}\n\nexport function useEditorCharacterCount<V extends Editor | undefined>(\n editor: () => V,\n): () => number | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getCharacterCount());\n}\n\nexport function useEditorIsActive<V extends Editor | undefined, R extends Record<string, any>>(\n editor: () => V,\n ...args: [name: () => string, options?: R] | [options: R]\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => {\n if (args.length === 2) {\n return instance?.isActive(\n args[0](),\n args[1],\n );\n }\n return instance?.isActive(\n args[0],\n );\n });\n}\n\nexport function useEditorIsEmpty<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isEmpty);\n}\n\nexport function useEditorIsEditable<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isEditable);\n}\n\nexport function useEditorIsFocused<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isFocused);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAIO;AACP,kBAGO;AAUA,SAAS,wBACd,UACA,MACS;AACT,QAAM,CAAC,QAAQ,SAAS,QAAI,8BAAa,CAAC,CAAC;AAE3C,WAAS,cAAc;AACrB,cAAU,CAAC,CAAC;AAAA,EACd;AAEA,oCAAa,MAAM;AACjB,UAAM,SAAS,SAAS;AACxB,QAAI,QAAQ;AACV,aAAO,GAAG,eAAe,WAAW;AACpC,qCAAU,MAAM;AACd,eAAO,IAAI,eAAe,WAAW;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,MAAM;AACX,WAAO;AACP,WAAO,KAAK,SAAS,CAAC;AAAA,EACxB;AACF;AAEe,SAAR,UACL,OAC0B;AAC1B,QAAM,CAAC,QAAQ,SAAS,QAAI,8BAAqB;AAEjD,oCAAa,MAAM;AACjB,UAAM,WAAW,IAAI,mBAAO;AAAA,MAC1B,GAAG,MAAM;AAAA,IACX,CAAC;AAED,mCAAU,MAAM;AACd,eAAS,QAAQ;AAAA,IACnB,CAAC;AAED,cAAU,QAAQ;AAAA,EACpB,CAAC;AAED,SAAO;AACT;AAEO,SAAS,cACd,QAC0B;AAC1B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAS;AAC1E;AAEO,SAAS,cACd,QACqB;AACrB,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAc;AAC/E;AAEO,SAAS,wBACd,QAC0B;AAC1B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,mBAAmB;AACpF;AAEO,SAAS,kBACd,WACG,MACwB;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa;AACnD,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO,qCAAU;AAAA,QACf,KAAK,CAAC,EAAE;AAAA,QACR,KAAK,CAAC;AAAA;AAAA,IAEV;AACA,WAAO,qCAAU;AAAA,MACf,KAAK,CAAC;AAAA;AAAA,EAEV,CAAC;AACH;AAEO,SAAS,iBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,OAAO;AACxE;AAEO,SAAS,oBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,UAAU;AAC3E;AAEO,SAAS,mBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAS;AAC1E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!R.call(t,i)&&i!==o&&s(t,i,{get:()=>e[i],enumerable:!(u=O(e,i))||u.enumerable});return t};var I=t=>y(s({},"__esModule",{value:!0}),t);var C={};b(C,{createEditor:()=>n,createEditorTransaction:()=>d,createTiptapEditor:()=>n,useEditor:()=>n,useEditorCharacterCount:()=>l,useEditorHTML:()=>p,useEditorIsActive:()=>a,useEditorIsEditable:()=>T,useEditorIsEmpty:()=>V,useEditorIsFocused:()=>m,useEditorJSON:()=>x,useTiptapEditor:()=>n});module.exports=I(C);var r=require("solid-js"),f=require("@tiptap/core");function d(t,e){let[o,u]=(0,r.createSignal)([]);function i(){u([])}return(0,r.createEffect)(()=>{let E=t();E&&(E.on("transaction",i),(0,r.onCleanup)(()=>{E.off("transaction",i)}))}),()=>(o(),e(t()))}function n(t){let[e,o]=(0,r.createSignal)();return(0,r.createEffect)(()=>{let u=new f.Editor({...t()});(0,r.onCleanup)(()=>{u.destroy()}),o(u)}),e}function p(t){return d(t,e=>e==null?void 0:e.getHTML())}function x(t){return d(t,e=>e==null?void 0:e.getJSON())}function l(t){return d(t,e=>e==null?void 0:e.getCharacterCount())}function a(t,...e){return d(t,o=>e.length===2?o==null?void 0:o.isActive(e[0](),e[1]):o==null?void 0:o.isActive(e[0]))}function V(t){return d(t,e=>e==null?void 0:e.isEmpty)}function T(t){return d(t,e=>e==null?void 0:e.isEditable)}function m(t){return d(t,e=>e==null?void 0:e.isFocused)}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
1
|
// src/Editor.tsx
|
|
19
2
|
import {
|
|
20
3
|
createEffect,
|
|
@@ -46,7 +29,9 @@ function createEditorTransaction(instance, read) {
|
|
|
46
29
|
function useEditor(props) {
|
|
47
30
|
const [signal, setSignal] = createSignal();
|
|
48
31
|
createEffect(() => {
|
|
49
|
-
const instance = new Editor(
|
|
32
|
+
const instance = new Editor({
|
|
33
|
+
...props()
|
|
34
|
+
});
|
|
50
35
|
onCleanup(() => {
|
|
51
36
|
instance.destroy();
|
|
52
37
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Editor.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n createEffect,\n createSignal,\n onCleanup,\n} from 'solid-js';\nimport {\n Editor,\n EditorOptions,\n} from '@tiptap/core';\n\nexport type EditorRef = Editor | ((editor: Editor) => void);\n\nexport type BaseEditorOptions = Omit<Partial<EditorOptions>, 'element'>;\n\nexport interface UseEditorOptions<T extends HTMLElement> extends BaseEditorOptions {\n element: T;\n}\n\nexport function createEditorTransaction<T, V extends Editor | undefined>(\n instance: () => V,\n read: (value: V) => T,\n): () => T {\n const [signal, setSignal] = createSignal([]);\n\n function forceUpdate() {\n setSignal([]);\n }\n\n createEffect(() => {\n const editor = instance();\n if (editor) {\n editor.on('transaction', forceUpdate);\n onCleanup(() => {\n editor.off('transaction', forceUpdate);\n });\n }\n });\n\n return () => {\n signal();\n return read(instance());\n };\n}\n\nexport default function useEditor<T extends HTMLElement>(\n props: () => UseEditorOptions<T>,\n): () => Editor | undefined {\n const [signal, setSignal] = createSignal<Editor>();\n\n createEffect(() => {\n const instance = new Editor({\n ...props(),\n });\n\n onCleanup(() => {\n instance.destroy();\n });\n\n setSignal(instance);\n });\n\n return signal;\n}\n\nexport function useEditorHTML<V extends Editor | undefined>(\n editor: () => V,\n): () => string | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getHTML());\n}\n\nexport function useEditorJSON<V extends Editor | undefined, R extends Record<string, any>>(\n editor: () => V,\n): () => R | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getJSON() as R);\n}\n\nexport function useEditorCharacterCount<V extends Editor | undefined>(\n editor: () => V,\n): () => number | undefined {\n return createEditorTransaction(editor, (instance) => instance?.getCharacterCount());\n}\n\nexport function useEditorIsActive<V extends Editor | undefined, R extends Record<string, any>>(\n editor: () => V,\n ...args: [name: () => string, options?: R] | [options: R]\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => {\n if (args.length === 2) {\n return instance?.isActive(\n args[0](),\n args[1],\n );\n }\n return instance?.isActive(\n args[0],\n );\n });\n}\n\nexport function useEditorIsEmpty<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isEmpty);\n}\n\nexport function useEditorIsEditable<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isEditable);\n}\n\nexport function useEditorIsFocused<V extends Editor | undefined>(\n editor: () => V,\n): () => boolean | undefined {\n return createEditorTransaction(editor, (instance) => instance?.isFocused);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AAUA,SAAS,wBACd,UACA,MACS;AACT,QAAM,CAAC,QAAQ,SAAS,IAAI,aAAa,CAAC,CAAC;AAE3C,WAAS,cAAc;AACrB,cAAU,CAAC,CAAC;AAAA,EACd;AAEA,eAAa,MAAM;AACjB,UAAM,SAAS,SAAS;AACxB,QAAI,QAAQ;AACV,aAAO,GAAG,eAAe,WAAW;AACpC,gBAAU,MAAM;AACd,eAAO,IAAI,eAAe,WAAW;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,MAAM;AACX,WAAO;AACP,WAAO,KAAK,SAAS,CAAC;AAAA,EACxB;AACF;AAEe,SAAR,UACL,OAC0B;AAC1B,QAAM,CAAC,QAAQ,SAAS,IAAI,aAAqB;AAEjD,eAAa,MAAM;AACjB,UAAM,WAAW,IAAI,OAAO;AAAA,MAC1B,GAAG,MAAM;AAAA,IACX,CAAC;AAED,cAAU,MAAM;AACd,eAAS,QAAQ;AAAA,IACnB,CAAC;AAED,cAAU,QAAQ;AAAA,EACpB,CAAC;AAED,SAAO;AACT;AAEO,SAAS,cACd,QAC0B;AAC1B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAS;AAC1E;AAEO,SAAS,cACd,QACqB;AACrB,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAc;AAC/E;AAEO,SAAS,wBACd,QAC0B;AAC1B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,mBAAmB;AACpF;AAEO,SAAS,kBACd,WACG,MACwB;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa;AACnD,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO,qCAAU;AAAA,QACf,KAAK,CAAC,EAAE;AAAA,QACR,KAAK,CAAC;AAAA;AAAA,IAEV;AACA,WAAO,qCAAU;AAAA,MACf,KAAK,CAAC;AAAA;AAAA,EAEV,CAAC;AACH;AAEO,SAAS,iBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,OAAO;AACxE;AAEO,SAAS,oBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,UAAU;AAC3E;AAEO,SAAS,mBACd,QAC2B;AAC3B,SAAO,wBAAwB,QAAQ,CAAC,aAAa,qCAAU,SAAS;AAC1E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createEffect as E,createSignal as s,onCleanup as f}from"solid-js";import{Editor as p}from"@tiptap/core";function r(t,e){let[o,i]=s([]);function n(){i([])}return E(()=>{let u=t();u&&(u.on("transaction",n),f(()=>{u.off("transaction",n)}))}),()=>(o(),e(t()))}function d(t){let[e,o]=s();return E(()=>{let i=new p({...t()});f(()=>{i.destroy()}),o(i)}),e}function x(t){return r(t,e=>e==null?void 0:e.getHTML())}function l(t){return r(t,e=>e==null?void 0:e.getJSON())}function a(t){return r(t,e=>e==null?void 0:e.getCharacterCount())}function V(t,...e){return r(t,o=>e.length===2?o==null?void 0:o.isActive(e[0](),e[1]):o==null?void 0:o.isActive(e[0]))}function T(t){return r(t,e=>e==null?void 0:e.isEmpty)}function m(t){return r(t,e=>e==null?void 0:e.isEditable)}function O(t){return r(t,e=>e==null?void 0:e.isFocused)}export{d as createEditor,r as createEditorTransaction,d as createTiptapEditor,d as useEditor,a as useEditorCharacterCount,x as useEditorHTML,V as useEditorIsActive,m as useEditorIsEditable,T as useEditorIsEmpty,O as useEditorIsFocused,l as useEditorJSON,d as useTiptapEditor};
|
package/dist/types/Editor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor, EditorOptions } from '@tiptap/core';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type EditorRef = Editor | ((editor: Editor) => void);
|
|
3
|
+
export type BaseEditorOptions = Omit<Partial<EditorOptions>, 'element'>;
|
|
4
4
|
export interface UseEditorOptions<T extends HTMLElement> extends BaseEditorOptions {
|
|
5
5
|
element: T;
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.5.0",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"types": "./dist/types/index.d.ts",
|
|
5
5
|
"main": "./dist/cjs/production/index.cjs",
|
|
@@ -28,17 +28,19 @@
|
|
|
28
28
|
],
|
|
29
29
|
"name": "solid-tiptap",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
31
|
+
"@tiptap/core": "^2.0.0-beta.220",
|
|
32
|
+
"@tiptap/pm": "^2.0.0-beta.220",
|
|
33
|
+
"@types/node": "^18.14.5",
|
|
34
|
+
"eslint": "^8.35.0",
|
|
34
35
|
"eslint-config-lxsmnsyc": "^0.4.8",
|
|
35
|
-
"pridepack": "^2.
|
|
36
|
-
"solid-js": "^1.
|
|
37
|
-
"tslib": "^2.
|
|
38
|
-
"typescript": "^4.
|
|
36
|
+
"pridepack": "^2.4.1",
|
|
37
|
+
"solid-js": "^1.6.11",
|
|
38
|
+
"tslib": "^2.5.0",
|
|
39
|
+
"typescript": "^4.9.5"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
42
|
+
"@tiptap/core": "^2.0.0-beta.220",
|
|
43
|
+
"@tiptap/pm": "^2.0.0-beta.220",
|
|
42
44
|
"solid-js": "^1.2"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
@@ -67,5 +69,5 @@
|
|
|
67
69
|
"typesVersions": {
|
|
68
70
|
"*": {}
|
|
69
71
|
},
|
|
70
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "834b9023575db727cfe451d664a6184d2db4cdfe"
|
|
71
73
|
}
|