@musaaj/simpleeditor 0.0.1 → 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.
- package/README.md +17 -9
- package/dist/simpleeditor.js +5 -18
- package/dist/types/builtins/blots/math/field.d.ts +1 -1
- package/dist/types/builtins/blots/math/field.d.ts.map +1 -1
- package/dist/types/quill-chem-blot.d.ts.map +1 -1
- package/dist/types/quill-image-blot.d.ts.map +1 -1
- package/dist/types/quill-math-blot.d.ts.map +1 -1
- package/dist/types/quill-table-blot.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ SimpleEditor ships two web components powered by Quill:
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
yarn add simpleeditor
|
|
11
|
+
yarn add @musaaj/simpleeditor
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
|
-
import "simpleeditor";
|
|
18
|
-
import "simpleeditor/style.css";
|
|
17
|
+
import "@musaaj/simpleeditor";
|
|
18
|
+
import "@musaaj/simpleeditor/style.css";
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
```html
|
|
@@ -62,8 +62,8 @@ Use the wrapper components in `examples/react/quill-components.tsx` to avoid han
|
|
|
62
62
|
Example:
|
|
63
63
|
|
|
64
64
|
```tsx
|
|
65
|
-
import "simpleeditor";
|
|
66
|
-
import "simpleeditor/style.css";
|
|
65
|
+
import "@musaaj/simpleeditor";
|
|
66
|
+
import "@musaaj/simpleeditor/style.css";
|
|
67
67
|
import { QuillTextareaReact, QuillDivReact } from "./quill-components";
|
|
68
68
|
import { useState } from "react";
|
|
69
69
|
|
|
@@ -121,21 +121,29 @@ System dark mode:
|
|
|
121
121
|
## Build and Publish
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
|
|
124
|
+
npm run build
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Build output:
|
|
128
128
|
|
|
129
129
|
- `dist/simpleeditor.js`
|
|
130
|
-
- `dist/
|
|
131
|
-
- `dist/types
|
|
130
|
+
- `dist/simpleeditor.css`
|
|
131
|
+
- `dist/types/main.d.ts`
|
|
132
132
|
|
|
133
133
|
`npm publish` will run build automatically via `prepublishOnly`.
|
|
134
134
|
|
|
135
135
|
## Development
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
|
|
138
|
+
npm run dev
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Test and Typecheck
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm run test
|
|
145
|
+
npm run test:run
|
|
146
|
+
npm run typecheck
|
|
139
147
|
```
|
|
140
148
|
|
|
141
149
|
## Docs
|
package/dist/simpleeditor.js
CHANGED
|
@@ -45688,7 +45688,6 @@ core_default.register({
|
|
|
45688
45688
|
"ui/tooltip": tooltip_default
|
|
45689
45689
|
}, !0);
|
|
45690
45690
|
var quill_default = core_default;
|
|
45691
|
-
customElements.get("math-field") || customElements.define("math-field", _t);
|
|
45692
45691
|
function createMathSpanElement(e) {
|
|
45693
45692
|
let t = document.createElement(MATH_SPAN_TAG);
|
|
45694
45693
|
return t.setAttribute(DATA_LATEX, e), t.textContent = e, t;
|
|
@@ -45699,10 +45698,6 @@ function registerQuillMathBlot(e) {
|
|
|
45699
45698
|
registered$2 = !0;
|
|
45700
45699
|
let t = e.import("blots/embed");
|
|
45701
45700
|
class n extends t {
|
|
45702
|
-
static blotName = "math";
|
|
45703
|
-
static tagName = "span";
|
|
45704
|
-
static className = "qt-math-blot";
|
|
45705
|
-
static quill = null;
|
|
45706
45701
|
static create(e) {
|
|
45707
45702
|
let n = t.create(), r = typeof e == "string" ? e : e?.latex ?? "", i = typeof e == "string" ? "" : e?.id ?? "";
|
|
45708
45703
|
return n.setAttribute(DATA_LATEX, r), n.setAttribute("contenteditable", "false"), i && n.setAttribute("data-qt-id", i), n.__latex = r, n.appendChild(createMathSpanElement(r)), n.addEventListener("pointerdown", (e) => {
|
|
@@ -45718,7 +45713,7 @@ function registerQuillMathBlot(e) {
|
|
|
45718
45713
|
return e.__latex ?? e.getAttribute("data-latex") ?? "";
|
|
45719
45714
|
}
|
|
45720
45715
|
}
|
|
45721
|
-
e.register("formats/math", n, !0);
|
|
45716
|
+
n.blotName = "math", n.tagName = "span", n.className = "qt-math-blot", n.quill = null, e.register("formats/math", n, !0);
|
|
45722
45717
|
}
|
|
45723
45718
|
function setQuillMathBlotQuill(e) {
|
|
45724
45719
|
let t = quill_default.import("formats/math");
|
|
@@ -45804,9 +45799,6 @@ function registerQuillImageBlot(e) {
|
|
|
45804
45799
|
registered$1 = !0;
|
|
45805
45800
|
let t = e.import("blots/embed");
|
|
45806
45801
|
class n extends t {
|
|
45807
|
-
static blotName = "image";
|
|
45808
|
-
static tagName = IMG_BLOT_TAG;
|
|
45809
|
-
static className = "qt-image-blot";
|
|
45810
45802
|
static create(e) {
|
|
45811
45803
|
return createImageBlot(typeof e == "string" ? e : e?.src ?? "", typeof e == "string" ? "" : e?.alt ?? "", typeof e == "string" ? null : e?.width ?? null, typeof e == "string" ? null : e?.height ?? null);
|
|
45812
45804
|
}
|
|
@@ -45820,7 +45812,7 @@ function registerQuillImageBlot(e) {
|
|
|
45820
45812
|
};
|
|
45821
45813
|
}
|
|
45822
45814
|
}
|
|
45823
|
-
e.register("formats/image", n, !0);
|
|
45815
|
+
n.blotName = "image", n.tagName = IMG_BLOT_TAG, n.className = "qt-image-blot", e.register("formats/image", n, !0);
|
|
45824
45816
|
}
|
|
45825
45817
|
function buildTable(e, t) {
|
|
45826
45818
|
let n = document.createElement("table");
|
|
@@ -46509,8 +46501,6 @@ function createTableBlot(e = 2, t = 2, n = "clean") {
|
|
|
46509
46501
|
function registerQuillTableBlot(e) {
|
|
46510
46502
|
let t = e.import("blots/block/embed");
|
|
46511
46503
|
class n extends t {
|
|
46512
|
-
static blotName = "table";
|
|
46513
|
-
static tagName = "table-blot";
|
|
46514
46504
|
static create(e) {
|
|
46515
46505
|
let t = e?.theme ?? "clean", n = parseTableHtml(e?.html), r = createTableBlot(e?.rows ?? n?.rows.length ?? 2, e?.cols ?? getMaxCols(n) ?? 2, t);
|
|
46516
46506
|
if (r.style.display = "inline-block", r.style.maxWidth = "100%", n) {
|
|
@@ -46529,7 +46519,7 @@ function registerQuillTableBlot(e) {
|
|
|
46529
46519
|
};
|
|
46530
46520
|
}
|
|
46531
46521
|
}
|
|
46532
|
-
e.register("formats/table", n, !0);
|
|
46522
|
+
n.blotName = "table", n.tagName = "table-blot", e.register("formats/table", n, !0);
|
|
46533
46523
|
}
|
|
46534
46524
|
function parseTableHtml(e) {
|
|
46535
46525
|
if (!e) return null;
|
|
@@ -46567,9 +46557,6 @@ function registerQuillChemBlot(e) {
|
|
|
46567
46557
|
registered = !0;
|
|
46568
46558
|
let t = e.import("blots/embed");
|
|
46569
46559
|
class n extends t {
|
|
46570
|
-
static blotName = "chem";
|
|
46571
|
-
static tagName = "span";
|
|
46572
|
-
static className = "qt-chem-blot";
|
|
46573
46560
|
static create(e) {
|
|
46574
46561
|
let n = t.create(), r = typeof e == "string" ? e : e?.formula ?? "";
|
|
46575
46562
|
return n.setAttribute(DATA_FORMULA, r), n.setAttribute("contenteditable", "false"), n.__formula = r, n.appendChild(createChemSpan(r)), n.addEventListener("pointerdown", (e) => {
|
|
@@ -46585,7 +46572,7 @@ function registerQuillChemBlot(e) {
|
|
|
46585
46572
|
return e.__formula ?? e.getAttribute("data-formula") ?? "";
|
|
46586
46573
|
}
|
|
46587
46574
|
}
|
|
46588
|
-
e.register("formats/chem", n, !0);
|
|
46575
|
+
n.blotName = "chem", n.tagName = "span", n.className = "qt-chem-blot", e.register("formats/chem", n, !0);
|
|
46589
46576
|
}
|
|
46590
46577
|
function createChemEditor(e, t) {
|
|
46591
46578
|
let n = document.createElement(CHEM_SPAN_TAG);
|
|
@@ -46958,7 +46945,7 @@ var QuillTextarea = class extends HTMLElement {
|
|
|
46958
46945
|
}
|
|
46959
46946
|
bindMathEditor() {
|
|
46960
46947
|
if (!this.mathFieldHost) return;
|
|
46961
|
-
let e =
|
|
46948
|
+
let e = document.createElement("math-field");
|
|
46962
46949
|
e.setAttribute("virtual-keyboard-mode", "onfocus"), this.mathFieldHost.appendChild(e), this.mathField = e, this.mathSaveBtn?.addEventListener("click", () => this.saveMathEditor()), this.mathCancelBtn?.addEventListener("click", () => this.closeMathEditor(!0)), this.mathModal?.addEventListener("click", (e) => {
|
|
46963
46950
|
e.target === this.mathModal && this.closeMathEditor(!0);
|
|
46964
46951
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "mathlive";
|
|
2
|
-
import { MathfieldElement } from "mathlive";
|
|
2
|
+
import type { MathfieldElement } from "mathlive";
|
|
3
3
|
export declare function createMathSpanElement(value: string): HTMLElement;
|
|
4
4
|
export declare function createMathFieldElement(value: string, onValueChange: (next: string) => void): MathfieldElement;
|
|
5
5
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../../src/builtins/blots/math/field.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../../src/builtins/blots/math/field.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAKhE;AAED,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GACtC,gBAAgB,CAoBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quill-chem-blot.d.ts","sourceRoot":"","sources":["../../src/quill-chem-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAI9B,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"quill-chem-blot.d.ts","sourceRoot":"","sources":["../../src/quill-chem-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAI9B,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,CAuCjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quill-image-blot.d.ts","sourceRoot":"","sources":["../../src/quill-image-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AA4C9B,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"quill-image-blot.d.ts","sourceRoot":"","sources":["../../src/quill-image-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AA4C9B,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,CAkClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quill-math-blot.d.ts","sourceRoot":"","sources":["../../src/quill-math-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAI9B,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"quill-math-blot.d.ts","sourceRoot":"","sources":["../../src/quill-math-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAI9B,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI,CA2CjE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAMlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quill-table-blot.d.ts","sourceRoot":"","sources":["../../src/quill-table-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,OAAO,CAAC;AAanC,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"quill-table-blot.d.ts","sourceRoot":"","sources":["../../src/quill-table-blot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,OAAO,CAAC;AAanC,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,SAAS,GAAG,IAAI,CA4CpE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@musaaj/simpleeditor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/simpleeditor.js",
|
|
7
7
|
"module": "./dist/simpleeditor.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"types": "./dist/types/main.d.ts",
|
|
12
12
|
"import": "./dist/simpleeditor.js"
|
|
13
13
|
},
|
|
14
|
-
"./style.css": "./dist/
|
|
14
|
+
"./style.css": "./dist/simpleeditor.css"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|