@lesjoursfr/edith 1.1.3 → 2.0.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/package.json +27 -33
- package/src/core/dom.js +1 -1
- package/src/ui/button.js +2 -2
- package/src/ui/editor.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesjoursfr/edith",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Simple WYSIWYG editor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "lesjoursfr/edith",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": "
|
|
15
|
+
"node": "18.x || 20.x"
|
|
16
16
|
},
|
|
17
17
|
"browserslist": [
|
|
18
18
|
"Chrome >= 60",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"type": "module",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"freshlock": "rm -rf node_modules/ && rm .yarn/install-state.gz && rm -r .yarn/cache/ && rm yarn.lock && yarn",
|
|
28
|
-
"stylelint-check": "stylelint-config-prettier-check",
|
|
29
28
|
"eslint-check": "eslint-config-prettier src/index.js",
|
|
30
29
|
"check-js": "eslint . --ext .js",
|
|
31
30
|
"check-sass": "stylelint **/*.scss",
|
|
@@ -45,40 +44,35 @@
|
|
|
45
44
|
"editor"
|
|
46
45
|
],
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
50
|
-
"@codemirror/lang-html": "^6.4.
|
|
51
|
-
"@fortawesome/fontawesome-free": "^6.
|
|
52
|
-
"@popperjs/core": "^2.11.
|
|
53
|
-
"ava": "^5.
|
|
47
|
+
"@babel/core": "^7.22.5",
|
|
48
|
+
"@babel/preset-env": "^7.22.5",
|
|
49
|
+
"@codemirror/lang-html": "^6.4.4",
|
|
50
|
+
"@fortawesome/fontawesome-free": "^6.4.0",
|
|
51
|
+
"@popperjs/core": "^2.11.8",
|
|
52
|
+
"ava": "^5.3.0",
|
|
54
53
|
"babel-loader": "^9.1.2",
|
|
55
54
|
"codemirror": "^6.0.1",
|
|
56
|
-
"css-loader": "^6.
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"eslint-config-prettier": "^8.
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"sass": "^
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"stylelint-config-prettier": "^9.0.4",
|
|
72
|
-
"stylelint-config-sass-guidelines": "^9.0.1",
|
|
73
|
-
"webpack": "^5.75.0",
|
|
74
|
-
"webpack-cli": "^5.0.1",
|
|
75
|
-
"webpack-dev-server": "^4.11.1"
|
|
55
|
+
"css-loader": "^6.8.1",
|
|
56
|
+
"eslint": "^8.42.0",
|
|
57
|
+
"eslint-config-prettier": "^8.8.0",
|
|
58
|
+
"jsdom": "^22.1.0",
|
|
59
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
60
|
+
"postcss": "^8.4.24",
|
|
61
|
+
"prettier": "^2.8.8",
|
|
62
|
+
"sass": "^1.63.2",
|
|
63
|
+
"sass-loader": "^13.3.1",
|
|
64
|
+
"style-loader": "^3.3.3",
|
|
65
|
+
"stylelint": "^15.7.0",
|
|
66
|
+
"stylelint-config-sass-guidelines": "^10.0.0",
|
|
67
|
+
"webpack": "^5.86.0",
|
|
68
|
+
"webpack-cli": "^5.1.4",
|
|
69
|
+
"webpack-dev-server": "^4.15.0"
|
|
76
70
|
},
|
|
77
71
|
"peerDependencies": {
|
|
78
|
-
"@codemirror/lang-html": "^6.4.
|
|
79
|
-
"@fortawesome/fontawesome-free": "^6.
|
|
80
|
-
"@popperjs/core": "^2.11.
|
|
72
|
+
"@codemirror/lang-html": "^6.4.4",
|
|
73
|
+
"@fortawesome/fontawesome-free": "^6.4.0",
|
|
74
|
+
"@popperjs/core": "^2.11.8",
|
|
81
75
|
"codemirror": "^6.0.1"
|
|
82
76
|
},
|
|
83
|
-
"packageManager": "yarn@3.
|
|
77
|
+
"packageManager": "yarn@3.6.0"
|
|
84
78
|
}
|
package/src/core/dom.js
CHANGED
|
@@ -317,7 +317,7 @@ export function cleanDomContent(root, style) {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// Remove all tag attributes for tags in the allowed list
|
|
320
|
-
if (hasTagName(el, ["b", "i", "q", "u", "s", "br"])) {
|
|
320
|
+
if (hasTagName(el, ["b", "i", "q", "u", "s", "br", "sup"])) {
|
|
321
321
|
resetAttributesTo(el, {});
|
|
322
322
|
continue;
|
|
323
323
|
}
|
package/src/ui/button.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createPopper } from "@popperjs/core";
|
|
|
2
2
|
import { Events } from "../core/event.js";
|
|
3
3
|
import { EditorModes } from "../core/mode.js";
|
|
4
4
|
|
|
5
|
-
function onButtonClick(context, kind
|
|
5
|
+
function onButtonClick(context, kind) {
|
|
6
6
|
switch (kind) {
|
|
7
7
|
case "bold":
|
|
8
8
|
context.editor.wrapInsideTag("b");
|
|
@@ -51,7 +51,7 @@ EdithButton.prototype.click = function (event) {
|
|
|
51
51
|
|
|
52
52
|
// Check if the onclick attribute is a internal function ID or a custom function
|
|
53
53
|
if (typeof this.onclick === "string") {
|
|
54
|
-
onButtonClick(this.ctx, this.onclick
|
|
54
|
+
onButtonClick(this.ctx, this.onclick);
|
|
55
55
|
} else {
|
|
56
56
|
this.onclick(this.ctx, event);
|
|
57
57
|
}
|
package/src/ui/editor.js
CHANGED
|
@@ -108,6 +108,11 @@ EdithEditor.prototype.getContent = function () {
|
|
|
108
108
|
(el) => el.nodeType === Node.ELEMENT_NODE && !isSelfClosing(el.tagName) && el.textContent.length === 0
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
+
// Remove any style attribute
|
|
112
|
+
for (const el of placeholder.querySelectorAll("[style]")) {
|
|
113
|
+
el.removeAttribute("style");
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
// Return clean code
|
|
112
117
|
return placeholder.innerHTML
|
|
113
118
|
.replace(/\u200B/gi, "")
|