@prosekit/extensions 0.0.11 → 0.0.13

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.
@@ -102,6 +102,15 @@ export declare function addHeadingSpec(): Extension< {
102
102
  NODES: "heading";
103
103
  }>;
104
104
 
105
+ /** @public */
106
+ export declare function addImage(): Extension< {
107
+ NODES: "image";
108
+ }>;
109
+
110
+ export declare function addImageSpec(): Extension< {
111
+ NODES: "image";
112
+ }>;
113
+
105
114
  /** @public */
106
115
  export declare function addItalic(): Extension< {
107
116
  MARKS: "italic";
@@ -230,6 +239,10 @@ export declare interface HeadingAttrs {
230
239
  level: number;
231
240
  }
232
241
 
242
+ export declare interface ImageAttrs {
243
+ src?: string | null;
244
+ }
245
+
233
246
  /** @public */
234
247
  export declare interface LinkAttrs {
235
248
  href: string;
@@ -1,4 +1,4 @@
1
- /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.1/node_modules/prosemirror-flat-list/dist/style.css */
1
+ /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.2/node_modules/prosemirror-flat-list/dist/style.css */
2
2
  .prosemirror-flat-list {
3
3
  padding: 0;
4
4
  margin-top: 0;
@@ -0,0 +1,3 @@
1
+ export { addImageSpec } from './_tsup-dts-rollup';
2
+ export { addImage } from './_tsup-dts-rollup';
3
+ export { ImageAttrs } from './_tsup-dts-rollup';
@@ -0,0 +1,35 @@
1
+ // src/image/index.ts
2
+ import { addNodeSpec, defineExtension } from "@prosekit/core";
3
+ function addImageSpec() {
4
+ return addNodeSpec({
5
+ name: "image",
6
+ attrs: {
7
+ src: { default: null }
8
+ },
9
+ group: "block",
10
+ defining: true,
11
+ parseDOM: [
12
+ {
13
+ tag: "img[src]",
14
+ getAttrs: (element) => {
15
+ if (typeof element === "string") {
16
+ return { src: null };
17
+ }
18
+ const src = element.getAttribute("src") || null;
19
+ return { src };
20
+ }
21
+ }
22
+ ],
23
+ toDOM(node) {
24
+ const attrs = node.attrs;
25
+ return ["img", attrs];
26
+ }
27
+ });
28
+ }
29
+ function addImage() {
30
+ return defineExtension([addImageSpec()]);
31
+ }
32
+ export {
33
+ addImage,
34
+ addImageSpec
35
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -60,6 +60,11 @@
60
60
  "import": "./dist/prosekit-extensions-heading.js",
61
61
  "default": "./dist/prosekit-extensions-heading.js"
62
62
  },
63
+ "./image": {
64
+ "types": "./dist/prosekit-extensions-image.d.ts",
65
+ "import": "./dist/prosekit-extensions-image.js",
66
+ "default": "./dist/prosekit-extensions-image.js"
67
+ },
63
68
  "./italic": {
64
69
  "types": "./dist/prosekit-extensions-italic.d.ts",
65
70
  "import": "./dist/prosekit-extensions-italic.js",
@@ -101,17 +106,17 @@
101
106
  "dist"
102
107
  ],
103
108
  "dependencies": {
104
- "@prosekit/core": "^0.0.10",
105
- "@prosekit/pm": "^0.0.5",
106
- "highlight.js": "^11.8.0",
107
- "prosemirror-flat-list": "^0.4.1",
109
+ "@prosekit/core": "^0.0.11",
110
+ "@prosekit/pm": "^0.0.6",
111
+ "highlight.js": "^11.9.0",
112
+ "prosemirror-flat-list": "^0.4.2",
108
113
  "prosemirror-highlightjs": "^0.9.1"
109
114
  },
110
115
  "devDependencies": {
111
116
  "@prosekit/dev": "*",
112
117
  "tsup": "^7.2.0",
113
118
  "typescript": "^5.2.2",
114
- "vitest": "^0.34.3"
119
+ "vitest": "^0.34.6"
115
120
  },
116
121
  "scripts": {
117
122
  "build:tsup": "tsup",
@@ -141,6 +146,9 @@
141
146
  "heading": [
142
147
  "./dist/prosekit-extensions-heading.d.ts"
143
148
  ],
149
+ "image": [
150
+ "./dist/prosekit-extensions-image.d.ts"
151
+ ],
144
152
  "italic": [
145
153
  "./dist/prosekit-extensions-italic.d.ts"
146
154
  ],