@livingdocs/editable.js 3.0.16 → 3.1.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/dist/editable.js +1 -1
- package/dist/editable.js.map +1 -1
- package/package.json +4 -4
- package/src/config.js +1 -0
- package/src/content.js +4 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livingdocs/editable.js",
|
|
3
3
|
"description": "Friendly contenteditable API",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/runtime": "^7.16.7",
|
|
7
7
|
"bowser": "2.11.0",
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"isCi": true,
|
|
84
84
|
"name": "Drone",
|
|
85
85
|
"service": "drone",
|
|
86
|
-
"commit": "
|
|
87
|
-
"build": "
|
|
86
|
+
"commit": "2e7b8ed5efd8fb418a159ded67be45ddf9941999",
|
|
87
|
+
"build": "482",
|
|
88
88
|
"branch": "master",
|
|
89
89
|
"isPr": false,
|
|
90
90
|
"slug": "livingdocsIO/editable.js",
|
|
91
|
-
"date": "2022-03-
|
|
91
|
+
"date": "2022-03-22T20:40:52.111Z"
|
|
92
92
|
}
|
|
93
93
|
}
|
package/src/config.js
CHANGED
package/src/content.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as rangeSaveRestore from './range-save-restore'
|
|
|
4
4
|
import * as parser from './parser'
|
|
5
5
|
import * as string from './util/string'
|
|
6
6
|
import {createElement} from './util/dom'
|
|
7
|
+
import config from './config'
|
|
7
8
|
|
|
8
9
|
function restoreRange (host, range, func) {
|
|
9
10
|
range = rangeSaveRestore.save(range)
|
|
@@ -161,7 +162,9 @@ function removeWhitespaces (node, type, firstCall = true) {
|
|
|
161
162
|
if (elem?.nodeType !== nodeType.textNode) return
|
|
162
163
|
// Remove whitespaces at the end or start of a block with content
|
|
163
164
|
// e.g. ' Hello world' > 'Hello World'
|
|
164
|
-
|
|
165
|
+
if (config.trimLeadingAndTrailingWhitespaces) {
|
|
166
|
+
elem.textContent = elem.textContent.replace(type.startsWith('last') ? / +$/ : /^ +/, '')
|
|
167
|
+
}
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
// Remove elements that were inserted for internal or user interface purposes
|