prosemirror-safari-ime-span 1.0.2 → 1.0.3

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/index.cjs CHANGED
@@ -1,74 +1,52 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key2 of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key2) && key2 !== except)
14
- __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- imeSpan: () => imeSpan
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var import_prosemirror_state = require("prosemirror-state");
27
- var import_prosemirror_view = require("prosemirror-view");
28
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let prosemirror_state = require("prosemirror-state");
3
+ let prosemirror_view = require("prosemirror-view");
29
4
  // src/browser.ts
30
- var nav = typeof navigator != "undefined" ? navigator : null;
31
- var agent = nav && nav.userAgent || "";
32
- var ie_edge = /Edge\/(\d+)/.exec(agent);
33
- var ie_upto10 = /MSIE \d/.exec(agent);
34
- var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
35
- var ie = !!(ie_upto10 || ie_11up || ie_edge);
36
- var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
37
-
5
+ const nav = typeof navigator != "undefined" ? navigator : null;
6
+ const agent = nav && nav.userAgent || "";
7
+ const ie_edge = /Edge\/(\d+)/.exec(agent);
8
+ const ie_upto10 = /MSIE \d/.exec(agent);
9
+ const ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
10
+ const safari = !!!(ie_upto10 || ie_11up || ie_edge) && !!nav && /Apple Computer/.test(nav.vendor);
38
11
  // src/index.ts
39
- var key = new import_prosemirror_state.PluginKey("safari-ime-span");
40
- var isComposing = false;
41
- var spec = {
42
- key,
43
- props: {
44
- decorations: createDecorations,
45
- handleDOMEvents: {
46
- compositionstart: () => {
47
- isComposing = true;
48
- },
49
- compositionend: () => {
50
- isComposing = false;
51
- }
52
- }
53
- }
12
+ const key = new prosemirror_state.PluginKey("safari-ime-span");
13
+ let isComposing = false;
14
+ const spec = {
15
+ key,
16
+ props: {
17
+ decorations: createDecorations,
18
+ handleDOMEvents: {
19
+ compositionstart: () => {
20
+ isComposing = true;
21
+ },
22
+ compositionend: () => {
23
+ isComposing = false;
24
+ }
25
+ }
26
+ }
54
27
  };
55
28
  function createDecorations(state) {
56
- const { $from, $to, to } = state.selection;
57
- if (isComposing && $from.sameParent($to)) {
58
- const deco = import_prosemirror_view.Decoration.widget(to, createSpan, {
59
- ignoreSelection: true,
60
- key: "safari-ime-span"
61
- });
62
- return import_prosemirror_view.DecorationSet.create(state.doc, [deco]);
63
- }
29
+ const { $from, $to, to } = state.selection;
30
+ if (isComposing && $from.sameParent($to)) {
31
+ const deco = prosemirror_view.Decoration.widget(to, createSpan, {
32
+ ignoreSelection: true,
33
+ key: "safari-ime-span"
34
+ });
35
+ return prosemirror_view.DecorationSet.create(state.doc, [deco]);
36
+ }
64
37
  }
65
38
  function createSpan(view) {
66
- const span = view.dom.ownerDocument.createElement("span");
67
- span.className = "ProseMirror-safari-ime-span";
68
- return span;
39
+ const span = view.dom.ownerDocument.createElement("span");
40
+ span.className = "ProseMirror-safari-ime-span";
41
+ return span;
69
42
  }
70
- var imeSpan = new import_prosemirror_state.Plugin(safari ? spec : { key });
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- imeSpan
74
- });
43
+ /**
44
+ * A plugin as a workaround for a bug in Safari that causes the composition
45
+ * based IME to remove the empty HTML element with CSS `position: relative`.
46
+ *
47
+ * See also https://github.com/ProseMirror/prosemirror/issues/934
48
+ *
49
+ * @public @group Plugins
50
+ */
51
+ const imeSpan = new prosemirror_state.Plugin(safari ? spec : { key });
52
+ exports.imeSpan = imeSpan;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import { Plugin } from 'prosemirror-state';
2
-
1
+ import { Plugin } from "prosemirror-state";
3
2
  /**
4
3
  * A plugin as a workaround for a bug in Safari that causes the composition
5
4
  * based IME to remove the empty HTML element with CSS `position: relative`.
@@ -8,6 +7,5 @@ import { Plugin } from 'prosemirror-state';
8
7
  *
9
8
  * @public @group Plugins
10
9
  */
11
- declare const imeSpan: Plugin<undefined>;
12
-
13
- export { imeSpan };
10
+ export declare const imeSpan: Plugin<undefined>;
11
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;qBAsDa,SAAO"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Plugin } from 'prosemirror-state';
2
-
1
+ import { Plugin } from "prosemirror-state";
3
2
  /**
4
3
  * A plugin as a workaround for a bug in Safari that causes the composition
5
4
  * based IME to remove the empty HTML element with CSS `position: relative`.
@@ -8,6 +7,5 @@ import { Plugin } from 'prosemirror-state';
8
7
  *
9
8
  * @public @group Plugins
10
9
  */
11
- declare const imeSpan: Plugin<undefined>;
12
-
13
- export { imeSpan };
10
+ export declare const imeSpan: Plugin<undefined>;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;qBAsDa,SAAO"}
package/dist/index.js CHANGED
@@ -1,52 +1,53 @@
1
- // src/index.ts
2
- import {
3
- Plugin,
4
- PluginKey
5
- } from "prosemirror-state";
1
+ import { Plugin, PluginKey } from "prosemirror-state";
6
2
  import { Decoration, DecorationSet } from "prosemirror-view";
7
-
8
3
  // src/browser.ts
9
- var nav = typeof navigator != "undefined" ? navigator : null;
10
- var agent = nav && nav.userAgent || "";
11
- var ie_edge = /Edge\/(\d+)/.exec(agent);
12
- var ie_upto10 = /MSIE \d/.exec(agent);
13
- var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
14
- var ie = !!(ie_upto10 || ie_11up || ie_edge);
15
- var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
16
-
4
+ const nav = typeof navigator != "undefined" ? navigator : null;
5
+ const agent = nav && nav.userAgent || "";
6
+ const ie_edge = /Edge\/(\d+)/.exec(agent);
7
+ const ie_upto10 = /MSIE \d/.exec(agent);
8
+ const ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
9
+ const safari = !!!(ie_upto10 || ie_11up || ie_edge) && !!nav && /Apple Computer/.test(nav.vendor);
17
10
  // src/index.ts
18
- var key = new PluginKey("safari-ime-span");
19
- var isComposing = false;
20
- var spec = {
21
- key,
22
- props: {
23
- decorations: createDecorations,
24
- handleDOMEvents: {
25
- compositionstart: () => {
26
- isComposing = true;
27
- },
28
- compositionend: () => {
29
- isComposing = false;
30
- }
31
- }
32
- }
11
+ const key = new PluginKey("safari-ime-span");
12
+ let isComposing = false;
13
+ const spec = {
14
+ key,
15
+ props: {
16
+ decorations: createDecorations,
17
+ handleDOMEvents: {
18
+ compositionstart: () => {
19
+ isComposing = true;
20
+ },
21
+ compositionend: () => {
22
+ isComposing = false;
23
+ }
24
+ }
25
+ }
33
26
  };
34
27
  function createDecorations(state) {
35
- const { $from, $to, to } = state.selection;
36
- if (isComposing && $from.sameParent($to)) {
37
- const deco = Decoration.widget(to, createSpan, {
38
- ignoreSelection: true,
39
- key: "safari-ime-span"
40
- });
41
- return DecorationSet.create(state.doc, [deco]);
42
- }
28
+ const { $from, $to, to } = state.selection;
29
+ if (isComposing && $from.sameParent($to)) {
30
+ const deco = Decoration.widget(to, createSpan, {
31
+ ignoreSelection: true,
32
+ key: "safari-ime-span"
33
+ });
34
+ return DecorationSet.create(state.doc, [deco]);
35
+ }
43
36
  }
44
37
  function createSpan(view) {
45
- const span = view.dom.ownerDocument.createElement("span");
46
- span.className = "ProseMirror-safari-ime-span";
47
- return span;
38
+ const span = view.dom.ownerDocument.createElement("span");
39
+ span.className = "ProseMirror-safari-ime-span";
40
+ return span;
48
41
  }
49
- var imeSpan = new Plugin(safari ? spec : { key });
50
- export {
51
- imeSpan
52
- };
42
+ /**
43
+ * A plugin as a workaround for a bug in Safari that causes the composition
44
+ * based IME to remove the empty HTML element with CSS `position: relative`.
45
+ *
46
+ * See also https://github.com/ProseMirror/prosemirror/issues/934
47
+ *
48
+ * @public @group Plugins
49
+ */
50
+ const imeSpan = new Plugin(safari ? spec : { key });
51
+ export { imeSpan };
52
+
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/browser.ts","../src/index.ts"],"sourcesContent":["// Copied from https://github.com/prosemirror/prosemirror-view/blob/1.33.8/src/browser.ts\n\nconst nav = typeof navigator != 'undefined' ? navigator : null\nconst agent = (nav && nav.userAgent) || ''\n\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent)\nconst ie_upto10 = /MSIE \\d/.exec(agent)\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent)\n\nconst ie = !!(ie_upto10 || ie_11up || ie_edge)\n\nexport const safari = !ie && !!nav && /Apple Computer/.test(nav.vendor)\n","import {\n Plugin,\n PluginKey,\n type EditorState,\n type PluginSpec,\n} from 'prosemirror-state'\nimport { Decoration, DecorationSet, type EditorView } from 'prosemirror-view'\n\nimport { safari } from './browser'\n\nconst key = new PluginKey('safari-ime-span')\n\nlet isComposing = false\n\nconst spec: PluginSpec<undefined> = {\n key,\n props: {\n decorations: createDecorations,\n handleDOMEvents: {\n compositionstart: () => {\n isComposing = true\n },\n compositionend: () => {\n isComposing = false\n },\n },\n },\n}\n\nfunction createDecorations(state: EditorState): DecorationSet | undefined {\n const { $from, $to, to } = state.selection\n if (isComposing && $from.sameParent($to)) {\n const deco = Decoration.widget(to, createSpan, {\n ignoreSelection: true,\n key: 'safari-ime-span',\n })\n return DecorationSet.create(state.doc, [deco])\n }\n}\n\nfunction createSpan(view: EditorView): HTMLSpanElement {\n const span = view.dom.ownerDocument.createElement('span')\n span.className = 'ProseMirror-safari-ime-span'\n return span\n}\n\n/**\n * A plugin as a workaround for a bug in Safari that causes the composition\n * based IME to remove the empty HTML element with CSS `position: relative`.\n *\n * See also https://github.com/ProseMirror/prosemirror/issues/934\n *\n * @public @group Plugins\n */\nexport const imeSpan = new Plugin(safari ? spec : { key })\n"],"mappings":";;;AAEA,MAAM,MAAM,OAAO,aAAa,cAAc,YAAY;AAC1D,MAAM,QAAS,OAAO,IAAI,aAAc;AAExC,MAAM,UAAU,cAAc,KAAK,KAAK;AACxC,MAAM,YAAY,UAAU,KAAK,KAAK;AACtC,MAAM,UAAU,wCAAwC,KAAK,KAAK;AAIlE,MAAa,SAAS,CAAC,CAFX,EAAE,aAAa,WAAW,YAET,CAAC,CAAC,OAAO,iBAAiB,KAAK,IAAI,MAAM;;ACDtE,MAAM,MAAM,IAAI,UAAU,iBAAiB;AAE3C,IAAI,cAAc;AAElB,MAAM,OAA8B;CAClC;CACA,OAAO;EACL,aAAa;EACb,iBAAiB;GACf,wBAAwB;IACtB,cAAc;GAChB;GACA,sBAAsB;IACpB,cAAc;GAChB;EACF;CACF;AACF;AAEA,SAAS,kBAAkB,OAA+C;CACxE,MAAM,EAAE,OAAO,KAAK,OAAO,MAAM;CACjC,IAAI,eAAe,MAAM,WAAW,GAAG,GAAG;EACxC,MAAM,OAAO,WAAW,OAAO,IAAI,YAAY;GAC7C,iBAAiB;GACjB,KAAK;EACP,CAAC;EACD,OAAO,cAAc,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC;CAC/C;AACF;AAEA,SAAS,WAAW,MAAmC;CACrD,MAAM,OAAO,KAAK,IAAI,cAAc,cAAc,MAAM;CACxD,KAAK,YAAY;CACjB,OAAO;AACT;;;;;;;;;AAUA,MAAa,UAAU,IAAI,OAAO,SAAS,OAAO,EAAE,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "prosemirror-safari-ime-span",
3
3
  "type": "module",
4
- "version": "1.0.2",
5
- "packageManager": "pnpm@8.15.8",
6
- "description": "",
4
+ "version": "1.0.3",
5
+ "description": "A ProseMirror plugin that works around a Safari IME bug that removes empty inline nodes",
7
6
  "author": "ocavue <ocavue@gmail.com>",
8
7
  "license": "MIT",
9
8
  "funding": "https://github.com/sponsors/ocavue",
@@ -13,24 +12,30 @@
13
12
  "url": "https://github.com/ocavue/prosemirror-safari-ime-span.git"
14
13
  },
15
14
  "bugs": "https://github.com/ocavue/prosemirror-safari-ime-span/issues",
16
- "keywords": [],
15
+ "keywords": [
16
+ "prosemirror",
17
+ "prosemirror-plugin",
18
+ "safari",
19
+ "webkit",
20
+ "ime",
21
+ "composition",
22
+ "input-method",
23
+ "rich-text-editor"
24
+ ],
17
25
  "sideEffects": false,
18
26
  "main": "./dist/index.cjs",
19
27
  "module": "./dist/index.js",
20
28
  "types": "./dist/index.d.ts",
21
29
  "exports": {
22
30
  ".": {
23
- "types": "./dist/index.d.ts",
24
- "require": "./dist/index.cjs",
25
- "import": "./dist/index.js"
26
- }
27
- },
28
- "typesVersions": {
29
- "*": {
30
- "*": [
31
- "./dist/*",
32
- "./dist/index.d.ts"
33
- ]
31
+ "import": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/index.d.cts",
37
+ "default": "./dist/index.cjs"
38
+ }
34
39
  }
35
40
  },
36
41
  "files": [
@@ -41,12 +46,17 @@
41
46
  "prosemirror-view": "^1.33.8"
42
47
  },
43
48
  "devDependencies": {
44
- "@ocavue/eslint-config": "^1.7.0",
45
- "@types/node": "^20.14.9",
46
- "eslint": "^8.57.0",
47
- "prettier": "^3.3.2",
48
- "tsup": "^8.1.0",
49
- "typescript": "^5.5.3"
49
+ "@ocavue/eslint-config": "^4.26.0",
50
+ "@ocavue/tsconfig": "^0.7.1",
51
+ "@types/node": "^24.0.0",
52
+ "eslint": "^10.16.0",
53
+ "jsdom": "^31.0.1",
54
+ "prettier": "^3.10.1",
55
+ "prosemirror-schema-basic": "^1.2.5",
56
+ "tsdown": "^0.23.7",
57
+ "typescript": "^6.0.3",
58
+ "vite": "^8.4.1",
59
+ "vitest": "^5.1.2"
50
60
  },
51
61
  "renovate": {
52
62
  "extends": [
@@ -54,10 +64,11 @@
54
64
  ]
55
65
  },
56
66
  "scripts": {
57
- "build": "tsup",
58
- "dev": "tsup --watch",
59
- "lint": "eslint .",
60
- "fix": "eslint --fix . && prettier --write .",
61
- "typecheck": "tsc --noEmit"
67
+ "build": "tsdown",
68
+ "dev": "tsdown --watch",
69
+ "lint": "eslint && prettier --check .",
70
+ "fix": "eslint --fix && prettier --write .",
71
+ "test": "vitest",
72
+ "typecheck": "tsc -b"
62
73
  }
63
74
  }