@livingdocs/editable.js 5.0.2 → 5.0.4
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 +5 -5
- package/src/block.js +2 -2
- package/src/clipboard.js +5 -5
- package/src/content.js +6 -6
- package/src/core.js +14 -14
- package/src/create-default-behavior.js +5 -5
- package/src/create-default-events.js +1 -1
- package/src/cursor.js +9 -10
- package/src/dispatcher.js +8 -8
- package/src/highlight-support.js +4 -4
- package/src/highlight-text.js +3 -3
- package/src/keyboard.js +4 -4
- package/src/monitored-highlighting.js +9 -9
- package/src/node-iterator.js +1 -1
- package/src/parser.js +4 -4
- package/src/plugins/highlighting/spellcheck-service.js +1 -1
- package/src/range-container.js +3 -3
- package/src/range-save-restore.js +3 -3
- package/src/selection-watcher.js +6 -6
- package/src/selection.js +8 -8
- package/src/util/binary_search.js +1 -1
- package/src/util/dom.js +2 -2
- package/src/util/element.js +1 -1
- package/src/util/error.js +1 -1
- package/src/util/log.js +1 -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": "5.0.
|
|
4
|
+
"version": "5.0.4",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/runtime": "^7.16.7",
|
|
7
7
|
"lodash-es": "^4.17.21"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"babel-loader": "^9.0.0",
|
|
16
16
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
17
17
|
"babel-plugin-istanbul": "^6.1.1",
|
|
18
|
-
"chai": "^
|
|
18
|
+
"chai": "^5.0.0",
|
|
19
19
|
"css-loader": "^6.5.1",
|
|
20
20
|
"eslint": "^8.8.0",
|
|
21
21
|
"eslint-plugin-react": "^7.28.0",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"isCi": true,
|
|
81
81
|
"name": "Drone",
|
|
82
82
|
"service": "drone",
|
|
83
|
-
"commit": "
|
|
84
|
-
"build": "
|
|
83
|
+
"commit": "073d92f4b56ff6ccd178419318035613784b9c62",
|
|
84
|
+
"build": "1420",
|
|
85
85
|
"branch": "master",
|
|
86
86
|
"isPr": false,
|
|
87
87
|
"slug": "livingdocsIO/editable.js",
|
|
88
|
-
"date": "
|
|
88
|
+
"date": "2024-01-22T16:07:46.062Z"
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/block.js
CHANGED
package/src/clipboard.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import config from './config'
|
|
2
|
-
import * as string from './util/string'
|
|
3
|
-
import * as nodeType from './node-type'
|
|
4
|
-
import * as quotes from './quotes'
|
|
5
|
-
import {isPlainTextBlock} from './block'
|
|
1
|
+
import config from './config.js'
|
|
2
|
+
import * as string from './util/string.js'
|
|
3
|
+
import * as nodeType from './node-type.js'
|
|
4
|
+
import * as quotes from './quotes.js'
|
|
5
|
+
import {isPlainTextBlock} from './block.js'
|
|
6
6
|
|
|
7
7
|
let allowedElements, allowedPlainTextElements, requiredAttributes, transformElements, blockLevelElements, replaceQuotes
|
|
8
8
|
let splitIntoBlocks, blacklistedElements
|
package/src/content.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as nodeType from './node-type'
|
|
2
|
-
import * as rangeSaveRestore from './range-save-restore'
|
|
3
|
-
import * as parser from './parser'
|
|
4
|
-
import * as string from './util/string'
|
|
5
|
-
import {createElement, createRange, getNodes, normalizeBoundaries, splitBoundaries, containsNodeText} from './util/dom'
|
|
6
|
-
import config from './config'
|
|
1
|
+
import * as nodeType from './node-type.js'
|
|
2
|
+
import * as rangeSaveRestore from './range-save-restore.js'
|
|
3
|
+
import * as parser from './parser.js'
|
|
4
|
+
import * as string from './util/string.js'
|
|
5
|
+
import {createElement, createRange, getNodes, normalizeBoundaries, splitBoundaries, containsNodeText} from './util/dom.js'
|
|
6
|
+
import config from './config.js'
|
|
7
7
|
|
|
8
8
|
function restoreRange (host, range, func) {
|
|
9
9
|
range = rangeSaveRestore.save(range)
|
package/src/core.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import config from './config'
|
|
2
|
-
import error from './util/error'
|
|
3
|
-
import * as parser from './parser'
|
|
4
|
-
import * as block from './block'
|
|
5
|
-
import * as content from './content'
|
|
6
|
-
import * as clipboard from './clipboard'
|
|
7
|
-
import Dispatcher from './dispatcher'
|
|
8
|
-
import Cursor from './cursor'
|
|
9
|
-
import highlightSupport from './highlight-support'
|
|
10
|
-
import MonitoredHighlighting from './monitored-highlighting'
|
|
11
|
-
import createDefaultEvents from './create-default-events'
|
|
12
|
-
import {textNodesUnder, getTextNodeAndRelativeOffset} from './util/element'
|
|
13
|
-
import {binaryCursorSearch} from './util/binary_search'
|
|
14
|
-
import {domArray, createRange, nodeContainsRange} from './util/dom'
|
|
1
|
+
import config from './config.js'
|
|
2
|
+
import error from './util/error.js'
|
|
3
|
+
import * as parser from './parser.js'
|
|
4
|
+
import * as block from './block.js'
|
|
5
|
+
import * as content from './content.js'
|
|
6
|
+
import * as clipboard from './clipboard.js'
|
|
7
|
+
import Dispatcher from './dispatcher.js'
|
|
8
|
+
import Cursor from './cursor.js'
|
|
9
|
+
import highlightSupport from './highlight-support.js'
|
|
10
|
+
import MonitoredHighlighting from './monitored-highlighting.js'
|
|
11
|
+
import createDefaultEvents from './create-default-events.js'
|
|
12
|
+
import {textNodesUnder, getTextNodeAndRelativeOffset} from './util/element.js'
|
|
13
|
+
import {binaryCursorSearch} from './util/binary_search.js'
|
|
14
|
+
import {domArray, createRange, nodeContainsRange} from './util/dom.js'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The Core module provides the Editable class that defines the Editable.JS
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as parser from './parser'
|
|
2
|
-
import * as content from './content'
|
|
3
|
-
import log from './util/log'
|
|
4
|
-
import * as block from './block'
|
|
5
|
-
import * as nodeType from './node-type'
|
|
1
|
+
import * as parser from './parser.js'
|
|
2
|
+
import * as content from './content.js'
|
|
3
|
+
import log from './util/log.js'
|
|
4
|
+
import * as block from './block.js'
|
|
5
|
+
import * as nodeType from './node-type.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The Behavior module defines the behavior triggered in response to the Editable.JS
|
package/src/cursor.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import * as viewport from './util/viewport'
|
|
2
|
-
|
|
3
|
-
import * as content from './content'
|
|
4
|
-
import * as parser from './parser'
|
|
5
|
-
import * as string from './util/string'
|
|
6
|
-
import {elementNode, documentFragmentNode} from './node-type'
|
|
7
|
-
import error from './util/error'
|
|
8
|
-
import * as rangeSaveRestore from './range-save-restore'
|
|
9
|
-
|
|
10
|
-
import {closest, getSelection, rangesAreEqual} from './util/dom'
|
|
1
|
+
import * as viewport from './util/viewport.js'
|
|
2
|
+
|
|
3
|
+
import * as content from './content.js'
|
|
4
|
+
import * as parser from './parser.js'
|
|
5
|
+
import * as string from './util/string.js'
|
|
6
|
+
import {elementNode, documentFragmentNode} from './node-type.js'
|
|
7
|
+
import error from './util/error.js'
|
|
8
|
+
import * as rangeSaveRestore from './range-save-restore.js'
|
|
9
|
+
import {closest, getSelection, rangesAreEqual} from './util/dom.js'
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* The Cursor module provides a cross-browser abstraction layer for cursor.
|
package/src/dispatcher.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {selectionchange} from './feature-detection'
|
|
2
|
-
import * as clipboard from './clipboard'
|
|
3
|
-
import eventable from './eventable'
|
|
4
|
-
import SelectionWatcher from './selection-watcher'
|
|
5
|
-
import config from './config'
|
|
6
|
-
import Keyboard from './keyboard'
|
|
7
|
-
import {closest} from './util/dom'
|
|
8
|
-
import {replaceLast, endsWithSingleSpace} from './util/string'
|
|
1
|
+
import {selectionchange} from './feature-detection.js'
|
|
2
|
+
import * as clipboard from './clipboard.js'
|
|
3
|
+
import eventable from './eventable.js'
|
|
4
|
+
import SelectionWatcher from './selection-watcher.js'
|
|
5
|
+
import config from './config.js'
|
|
6
|
+
import Keyboard from './keyboard.js'
|
|
7
|
+
import {closest} from './util/dom.js'
|
|
8
|
+
import {replaceLast, endsWithSingleSpace} from './util/string.js'
|
|
9
9
|
|
|
10
10
|
// This will be set to true once we detect the input event is working.
|
|
11
11
|
// Input event description on MDN:
|
package/src/highlight-support.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as content from './content'
|
|
2
|
-
import highlightText from './highlight-text'
|
|
3
|
-
import {searchText} from './plugins/highlighting/text-search'
|
|
4
|
-
import {createElement, createRange, toCharacterRange} from './util/dom'
|
|
1
|
+
import * as content from './content.js'
|
|
2
|
+
import highlightText from './highlight-text.js'
|
|
3
|
+
import {searchText} from './plugins/highlighting/text-search.js'
|
|
4
|
+
import {createElement, createRange, toCharacterRange} from './util/dom.js'
|
|
5
5
|
|
|
6
6
|
const highlightSupport = {
|
|
7
7
|
|
package/src/highlight-text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import NodeIterator from './node-iterator'
|
|
2
|
-
import * as nodeType from './node-type'
|
|
3
|
-
import {createRange} from './util/dom'
|
|
1
|
+
import NodeIterator from './node-iterator.js'
|
|
2
|
+
import * as nodeType from './node-type.js'
|
|
3
|
+
import {createRange} from './util/dom.js'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
|
package/src/keyboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRange, containsRange} from './util/dom'
|
|
2
|
-
import {contenteditableSpanBug} from './feature-detection'
|
|
3
|
-
import * as nodeType from './node-type'
|
|
4
|
-
import eventable from './eventable'
|
|
1
|
+
import {createRange, containsRange} from './util/dom.js'
|
|
2
|
+
import {contenteditableSpanBug} from './feature-detection.js'
|
|
3
|
+
import * as nodeType from './node-type.js'
|
|
4
|
+
import eventable from './eventable.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Keyboard module defines an event API for key events.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _merge from 'lodash-es/merge'
|
|
2
|
-
import * as nodeType from './node-type'
|
|
3
|
-
import * as content from './content'
|
|
4
|
-
import highlightText from './highlight-text'
|
|
5
|
-
import SpellcheckService from './plugins/highlighting/spellcheck-service'
|
|
6
|
-
import WhitespaceHighlighting from './plugins/highlighting/whitespace-highlighting'
|
|
7
|
-
import {searchAllWords} from './plugins/highlighting/text-search'
|
|
8
|
-
import MatchCollection from './plugins/highlighting/match-collection'
|
|
9
|
-
import highlightSupport from './highlight-support'
|
|
10
|
-
import {domArray, domSelector} from './util/dom'
|
|
2
|
+
import * as nodeType from './node-type.js'
|
|
3
|
+
import * as content from './content.js'
|
|
4
|
+
import highlightText from './highlight-text.js'
|
|
5
|
+
import SpellcheckService from './plugins/highlighting/spellcheck-service.js'
|
|
6
|
+
import WhitespaceHighlighting from './plugins/highlighting/whitespace-highlighting.js'
|
|
7
|
+
import {searchAllWords} from './plugins/highlighting/text-search.js'
|
|
8
|
+
import MatchCollection from './plugins/highlighting/match-collection.js'
|
|
9
|
+
import highlightSupport from './highlight-support.js'
|
|
10
|
+
import {domArray, domSelector} from './util/dom.js'
|
|
11
11
|
|
|
12
12
|
// Spellcheck and Whitespace Highlighting
|
|
13
13
|
// --------------------------------------
|
package/src/node-iterator.js
CHANGED
package/src/parser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as string from './util/string'
|
|
2
|
-
import * as nodeType from './node-type'
|
|
3
|
-
import config from './config'
|
|
4
|
-
import {closest} from './util/dom'
|
|
1
|
+
import * as string from './util/string.js'
|
|
2
|
+
import * as nodeType from './node-type.js'
|
|
3
|
+
import config from './config.js'
|
|
4
|
+
import {closest} from './util/dom.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The parser module provides helper methods to parse html-chunks
|
package/src/range-container.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import error from './util/error'
|
|
2
|
-
import * as nodeType from './node-type'
|
|
3
|
-
import {createRange, normalizeBoundaries} from './util/dom'
|
|
1
|
+
import error from './util/error.js'
|
|
2
|
+
import * as nodeType from './node-type.js'
|
|
3
|
+
import {createRange, normalizeBoundaries} from './util/dom.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Inspired by the Selection save and restore module for Rangy by Tim Down
|
package/src/selection-watcher.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as parser from './parser'
|
|
2
|
-
import RangeContainer from './range-container'
|
|
3
|
-
import Cursor from './cursor'
|
|
4
|
-
import Selection from './selection'
|
|
5
|
-
import {getSelection} from './util/dom'
|
|
1
|
+
import * as parser from './parser.js'
|
|
2
|
+
import RangeContainer from './range-container.js'
|
|
3
|
+
import Cursor from './cursor.js'
|
|
4
|
+
import Selection from './selection.js'
|
|
5
|
+
import {getSelection} from './util/dom.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The SelectionWatcher module watches for selection changes inside
|
|
@@ -46,7 +46,7 @@ export default class SelectionWatcher {
|
|
|
46
46
|
// rangeCount is 0 or 1 in all browsers except firefox
|
|
47
47
|
// firefox can work with multiple ranges
|
|
48
48
|
// (on a mac hold down the command key to select multiple ranges)
|
|
49
|
-
if (this.selection
|
|
49
|
+
if (this.selection?.rangeCount && successfulSync) {
|
|
50
50
|
const range = this.selection.getRangeAt(0)
|
|
51
51
|
const hostNode = parser.getHost(range.commonAncestorContainer)
|
|
52
52
|
if (hostNode) return new RangeContainer(hostNode, range)
|
package/src/selection.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import Cursor from './cursor'
|
|
2
|
-
import * as content from './content'
|
|
3
|
-
import * as parser from './parser'
|
|
4
|
-
import * as block from './block'
|
|
5
|
-
import config from './config'
|
|
6
|
-
import highlightSupport from './highlight-support'
|
|
7
|
-
import highlightText from './highlight-text'
|
|
1
|
+
import Cursor from './cursor.js'
|
|
2
|
+
import * as content from './content.js'
|
|
3
|
+
import * as parser from './parser.js'
|
|
4
|
+
import * as block from './block.js'
|
|
5
|
+
import config from './config.js'
|
|
6
|
+
import highlightSupport from './highlight-support.js'
|
|
7
|
+
import highlightText from './highlight-text.js'
|
|
8
8
|
import {
|
|
9
9
|
toCharacterRange,
|
|
10
10
|
rangeToHtml,
|
|
11
11
|
findStartExcludingWhitespace,
|
|
12
12
|
findEndExcludingWhitespace
|
|
13
|
-
} from './util/dom'
|
|
13
|
+
} from './util/dom.js'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The Selection module provides a cross-browser abstraction layer for range
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
import {getTotalCharCount, textNodesUnder, getTextNodeAndRelativeOffset} from './element'
|
|
2
|
+
import {getTotalCharCount, textNodesUnder, getTextNodeAndRelativeOffset} from './element.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This is a binary search algorithm implementation aimed at finding
|
package/src/util/dom.js
CHANGED
package/src/util/element.js
CHANGED
package/src/util/error.js
CHANGED
package/src/util/log.js
CHANGED