@livingdocs/editable.js 5.0.7 → 5.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@livingdocs/editable.js",
3
3
  "description": "Friendly contenteditable API",
4
- "version": "5.0.7",
4
+ "version": "5.0.9",
5
5
  "dependencies": {
6
6
  "@babel/runtime": "^7.16.7",
7
7
  "lodash-es": "^4.17.21"
@@ -16,7 +16,7 @@
16
16
  "babel-plugin-add-module-exports": "^1.0.4",
17
17
  "babel-plugin-istanbul": "^6.1.1",
18
18
  "chai": "^5.0.0",
19
- "css-loader": "^6.5.1",
19
+ "css-loader": "^7.0.0",
20
20
  "eslint": "^8.8.0",
21
21
  "eslint-plugin-react": "^7.28.0",
22
22
  "karma": "^6.3.13",
@@ -34,8 +34,8 @@
34
34
  "react-dom": "^18.0.0",
35
35
  "react-transition-group": "^4.4.2",
36
36
  "rimraf": "^5.0.0",
37
- "sinon": "^17.0.0",
38
- "style-loader": "^3.3.1",
37
+ "sinon": "^18.0.0",
38
+ "style-loader": "^4.0.0",
39
39
  "url-loader": "^4.1.1",
40
40
  "webpack": "^5.68.0",
41
41
  "webpack-cli": "^5.0.0",
@@ -80,11 +80,11 @@
80
80
  "isCi": true,
81
81
  "name": "Drone",
82
82
  "service": "drone",
83
- "commit": "c234c7ebb846f50a490747cca6d97093e4447d58",
84
- "build": "1475",
83
+ "commit": "240d82b1c7a2b66d5fa322236b5eaa2bdb8e2712",
84
+ "build": "1638",
85
85
  "branch": "master",
86
86
  "isPr": false,
87
87
  "slug": "livingdocsIO/editable.js",
88
- "date": "2024-02-28T13:53:13.641Z"
88
+ "date": "2024-06-28T14:06:28.269Z"
89
89
  }
90
90
  }
package/src/clipboard.js CHANGED
@@ -125,7 +125,7 @@ function conditionalNodeWrap (child, content, options) {
125
125
  // returns string of concatenated attributes e.g. 'target="_blank" rel="nofollow" href="/test.com"'
126
126
  function filterAttributes (nodeName, node) {
127
127
  return Array.from(node.attributes).reduce((attributes, {name, value}) => {
128
- if (allowedElements[nodeName][name] && value) {
128
+ if (allowedElements[nodeName]?.[name] && value) {
129
129
  return `${attributes} ${name}="${value}"`
130
130
  }
131
131
  return attributes
package/src/core.js CHANGED
@@ -382,7 +382,7 @@ export class Editable {
382
382
  */
383
383
  highlight ({editableHost, text, highlightId, textRange, raiseEvents, type = 'comment'}) {
384
384
  if (!textRange) {
385
- return highlightSupport.highlightText(editableHost, text, highlightId, type)
385
+ return highlightSupport.highlightText(editableHost, text, highlightId, type, raiseEvents ? this.dispatcher : undefined)
386
386
  }
387
387
  if (typeof textRange.start !== 'number' || typeof textRange.end !== 'number') {
388
388
  error(
@@ -7,7 +7,7 @@ const highlightSupport = {
7
7
 
8
8
  // Used to highlight arbitrary text in an editable. All occurrences
9
9
  // will be highlighted.
10
- highlightText (editableHost, text, highlightId, type) {
10
+ highlightText (editableHost, text, highlightId, type, dispatcher) {
11
11
  if (this.hasHighlight(editableHost, highlightId)) return
12
12
  const blockText = highlightText.extractText(editableHost)
13
13
 
@@ -19,6 +19,7 @@ const highlightSupport = {
19
19
  if (matches && matches.length) {
20
20
  if (highlightId) matches[0].id = highlightId
21
21
  highlightText.highlightMatches(editableHost, matches)
22
+ if (dispatcher) dispatcher.notify('change', editableHost)
22
23
  return matches[0].startIndex
23
24
  }
24
25
  },