@livingdocs/editable.js 5.0.8 → 5.0.10

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.8",
4
+ "version": "5.0.10",
5
5
  "dependencies": {
6
6
  "@babel/runtime": "^7.16.7",
7
7
  "lodash-es": "^4.17.21"
@@ -12,13 +12,15 @@
12
12
  "@babel/plugin-transform-runtime": "^7.16.10",
13
13
  "@babel/preset-env": "^7.16.11",
14
14
  "@babel/preset-react": "^7.16.7",
15
+ "@eslint/compat": "^1.1.0",
15
16
  "babel-loader": "^9.0.0",
16
17
  "babel-plugin-add-module-exports": "^1.0.4",
17
- "babel-plugin-istanbul": "^6.1.1",
18
+ "babel-plugin-istanbul": "^7.0.0",
18
19
  "chai": "^5.0.0",
19
- "css-loader": "^6.5.1",
20
- "eslint": "^8.8.0",
21
- "eslint-plugin-react": "^7.28.0",
20
+ "css-loader": "^7.0.0",
21
+ "eslint": "^9.6.0",
22
+ "eslint-plugin-react": "^7.34.3",
23
+ "globals": "^15.8.0",
22
24
  "karma": "^6.3.13",
23
25
  "karma-chrome-launcher": "^3.1.0",
24
26
  "karma-coverage": "^2.1.0",
@@ -33,9 +35,9 @@
33
35
  "react": "^18.0.0",
34
36
  "react-dom": "^18.0.0",
35
37
  "react-transition-group": "^4.4.2",
36
- "rimraf": "^5.0.0",
37
- "sinon": "^17.0.0",
38
- "style-loader": "^3.3.1",
38
+ "rimraf": "^6.0.0",
39
+ "sinon": "^18.0.0",
40
+ "style-loader": "^4.0.0",
39
41
  "url-loader": "^4.1.1",
40
42
  "webpack": "^5.68.0",
41
43
  "webpack-cli": "^5.0.0",
@@ -71,7 +73,7 @@
71
73
  "test:all": "npm run test:karma -s -- --browsers Chrome,Firefox,Safari",
72
74
  "test:karma": "karma start",
73
75
  "test:watch": "npm run test:karma -s -- --single-run false",
74
- "lint": "eslint --ignore-path .gitignore ."
76
+ "lint": "eslint"
75
77
  },
76
78
  "release": {
77
79
  "extends": "@livingdocs/semantic-release-presets/npm-github-verify"
@@ -80,11 +82,11 @@
80
82
  "isCi": true,
81
83
  "name": "Drone",
82
84
  "service": "drone",
83
- "commit": "6f67ea1ff90ab471e60c30a7000bdcb8c802c0ac",
84
- "build": "1487",
85
+ "commit": "56c68f84db59b7727b4aaf057fe350921862db70",
86
+ "build": "1673",
85
87
  "branch": "master",
86
88
  "isPr": false,
87
89
  "slug": "livingdocsIO/editable.js",
88
- "date": "2024-03-07T10:06:40.152Z"
90
+ "date": "2024-07-10T15:24:28.500Z"
89
91
  }
90
92
  }
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(
package/src/cursor.js CHANGED
@@ -296,7 +296,7 @@ export default class Cursor {
296
296
 
297
297
  retainVisibleSelection (callback) {
298
298
  this.save()
299
- callback()
299
+ callback() // eslint-disable-line callback-return
300
300
  this.restore()
301
301
  this.setVisibleSelection()
302
302
  }
@@ -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
  },
@@ -19,10 +19,9 @@ export default class SpellcheckService {
19
19
 
20
20
  this.spellcheckService(condensedText, (misspelledWords) => {
21
21
  if (misspelledWords && misspelledWords.length > 0) {
22
- callback(null, misspelledWords)
23
- } else {
24
- callback(null)
22
+ return callback(null, misspelledWords)
25
23
  }
24
+ return callback(null)
26
25
  })
27
26
  }
28
27