@livingdocs/editable.js 4.0.2 → 5.0.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/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@livingdocs/editable.js",
3
3
  "description": "Friendly contenteditable API",
4
- "version": "4.0.2",
4
+ "version": "5.0.0",
5
5
  "dependencies": {
6
6
  "@babel/runtime": "^7.16.7",
7
- "bowser": "2.11.0",
8
7
  "lodash-es": "^4.17.21"
9
8
  },
10
9
  "devDependencies": {
@@ -81,11 +80,11 @@
81
80
  "isCi": true,
82
81
  "name": "Drone",
83
82
  "service": "drone",
84
- "commit": "0eddadb3f53b6c6293fcdcd564e04815563379e4",
85
- "build": "1320",
83
+ "commit": "6be0ace70ff4180dfe612c8026ecfb9a88a92651",
84
+ "build": "1333",
86
85
  "branch": "master",
87
86
  "isPr": false,
88
87
  "slug": "livingdocsIO/editable.js",
89
- "date": "2023-10-17T15:57:46.402Z"
88
+ "date": "2023-10-20T10:13:40.826Z"
90
89
  }
91
90
  }
package/src/core.js CHANGED
@@ -9,7 +9,6 @@ import Cursor from './cursor'
9
9
  import highlightSupport from './highlight-support'
10
10
  import MonitoredHighlighting from './monitored-highlighting'
11
11
  import createDefaultEvents from './create-default-events'
12
- import browser from 'bowser'
13
12
  import {textNodesUnder, getTextNodeAndRelativeOffset} from './util/element'
14
13
  import {binaryCursorSearch} from './util/binary_search'
15
14
  import {domArray, createRange, nodeContainsRange} from './util/dom'
@@ -513,7 +512,6 @@ export class Editable {
513
512
  // Expose modules and editable
514
513
  Editable.parser = parser
515
514
  Editable.content = content
516
- Editable.browser = browser
517
515
 
518
516
  // Set up callback functions for several events.
519
517
  ;['focus', 'blur', 'flow', 'selection', 'cursor', 'newline',
@@ -1,5 +1,3 @@
1
- import browser from 'bowser'
2
-
3
1
  /**
4
2
  * Check for contenteditable support
5
3
  *
@@ -10,9 +8,13 @@ import browser from 'bowser'
10
8
  */
11
9
  export const contenteditable = typeof document.documentElement.contentEditable !== 'undefined'
12
10
 
13
- const parser = browser.getParser(window.navigator.userAgent)
14
- const browserEngine = parser.getEngineName()
15
- const webKit = browserEngine === 'WebKit'
11
+ // Detect webkit browser engine
12
+ // That way we can detect the contenteditable span bug on safari, but exclude chrome
13
+ // Regex taken from: https://github.com/lancedikson/bowser/blob/f09411489ced05811c91cc6670a8e4ca9cbe39a7/src/parser-engines.js#L93-L106
14
+ // Attention, this might be error prone as any engine version change breaks this.
15
+ const isBlink = /(apple)?webkit\/537\.36/i.test(window.navigator.userAgent)
16
+ const isWebkit = /(apple)?webkit/i.test(window.navigator.userAgent)
17
+ const webKit = !isBlink && isWebkit
16
18
 
17
19
  /**
18
20
  * Check selectionchange event (supported in IE, Chrome, Firefox and Safari)