@lesjoursfr/edith 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/package.json +11 -11
  2. package/src/ui/editor.js +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lesjoursfr/edith",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Simple WYSIWYG editor.",
5
5
  "license": "MIT",
6
6
  "repository": "lesjoursfr/edith",
@@ -46,33 +46,33 @@
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.22.5",
48
48
  "@babel/preset-env": "^7.22.5",
49
- "@codemirror/lang-html": "^6.4.4",
49
+ "@codemirror/lang-html": "^6.4.5",
50
50
  "@fortawesome/fontawesome-free": "^6.4.0",
51
51
  "@popperjs/core": "^2.11.8",
52
- "ava": "^5.3.0",
52
+ "ava": "^5.3.1",
53
53
  "babel-loader": "^9.1.2",
54
54
  "codemirror": "^6.0.1",
55
55
  "css-loader": "^6.8.1",
56
- "eslint": "^8.42.0",
56
+ "eslint": "^8.44.0",
57
57
  "eslint-config-prettier": "^8.8.0",
58
58
  "jsdom": "^22.1.0",
59
59
  "mini-css-extract-plugin": "^2.7.6",
60
60
  "postcss": "^8.4.24",
61
61
  "prettier": "^2.8.8",
62
- "sass": "^1.63.2",
63
- "sass-loader": "^13.3.1",
62
+ "sass": "^1.63.6",
63
+ "sass-loader": "^13.3.2",
64
64
  "style-loader": "^3.3.3",
65
- "stylelint": "^15.7.0",
65
+ "stylelint": "^15.9.0",
66
66
  "stylelint-config-sass-guidelines": "^10.0.0",
67
- "webpack": "^5.86.0",
67
+ "webpack": "^5.88.1",
68
68
  "webpack-cli": "^5.1.4",
69
- "webpack-dev-server": "^4.15.0"
69
+ "webpack-dev-server": "^4.15.1"
70
70
  },
71
71
  "peerDependencies": {
72
- "@codemirror/lang-html": "^6.4.4",
72
+ "@codemirror/lang-html": "^6.4.5",
73
73
  "@fortawesome/fontawesome-free": "^6.4.0",
74
74
  "@popperjs/core": "^2.11.8",
75
75
  "codemirror": "^6.0.1"
76
76
  },
77
- "packageManager": "yarn@3.6.0"
77
+ "packageManager": "yarn@3.6.1"
78
78
  }
package/src/ui/editor.js CHANGED
@@ -1,6 +1,13 @@
1
1
  import { EditorView, basicSetup } from "codemirror";
2
2
  import { html } from "@codemirror/lang-html";
3
- import { hasClass, hasTagName, createNodeWith, isSelfClosing, removeNodesRecursively } from "../core/dom.js";
3
+ import {
4
+ hasClass,
5
+ hasTagName,
6
+ createNodeWith,
7
+ isSelfClosing,
8
+ removeNodesRecursively,
9
+ unwrapNode,
10
+ } from "../core/dom.js";
4
11
  import {
5
12
  wrapInsideTag,
6
13
  replaceSelectionByHtml,
@@ -113,6 +120,13 @@ EdithEditor.prototype.getContent = function () {
113
120
  el.removeAttribute("style");
114
121
  }
115
122
 
123
+ // Unwrap span without attributes
124
+ for (const el of placeholder.querySelectorAll("span")) {
125
+ if (el.attributes.length === 0) {
126
+ unwrapNode(el);
127
+ }
128
+ }
129
+
116
130
  // Return clean code
117
131
  return placeholder.innerHTML
118
132
  .replace(/\u200B/gi, "")