tiptap-extension-izzy-resizable-image 0.1.7 → 0.1.9
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/README.md +2 -0
- package/npm/index.js +12 -11
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Resizable inline image node for TipTap v2 with eight resize handles, optional al
|
|
|
4
4
|
|
|
5
5
|
Demo: https://startinn.github.io/TipTap-Extension-Izzy-Resizable-Image/
|
|
6
6
|
|
|
7
|
+
Download: https://www.npmjs.com/package/tiptap-extension-izzy-resizable-image
|
|
8
|
+
|
|
7
9
|
## Features
|
|
8
10
|
|
|
9
11
|
- Inline resizable image with 8 handles (nw, n, ne, e, se, s, sw, w)
|
package/npm/index.js
CHANGED
|
@@ -39,11 +39,11 @@ class ResizableImageView {
|
|
|
39
39
|
this.img.src = node.attrs.src
|
|
40
40
|
this.img.alt = node.attrs.alt || ''
|
|
41
41
|
this.img.style.display = 'block'
|
|
42
|
-
this.img.style.userSelect = 'none'
|
|
43
|
-
this.img.style.pointerEvents = 'none'
|
|
44
|
-
if (node.attrs.id) this.img.id = node.attrs.id
|
|
45
|
-
if (node.attrs.class) this.img.className = node.attrs.class
|
|
46
|
-
if (node.attrs.width) this.img.style.width = node.attrs.width + 'px'
|
|
42
|
+
this.img.style.userSelect = 'none'
|
|
43
|
+
this.img.style.pointerEvents = 'none'
|
|
44
|
+
if (node.attrs.id) this.img.id = node.attrs.id
|
|
45
|
+
if (node.attrs.class) this.img.className = node.attrs.class
|
|
46
|
+
if (node.attrs.width) this.img.style.width = node.attrs.width + 'px'
|
|
47
47
|
if (node.attrs.height) {
|
|
48
48
|
this.img.style.height = node.attrs.height + 'px'
|
|
49
49
|
} else if (this.options && this.options.height) {
|
|
@@ -94,7 +94,7 @@ class ResizableImageView {
|
|
|
94
94
|
this.btnCenter.innerHTML = (node.attrs.iconCenter != null ? node.attrs.iconCenter : (this.options.alignMenuIcons?.center ?? '⇔'))
|
|
95
95
|
this.btnRight.innerHTML = (node.attrs.iconRight != null ? node.attrs.iconRight : (this.options.alignMenuIcons?.right ?? '⟹'))
|
|
96
96
|
this.btnClear.innerHTML = (node.attrs.iconClear != null ? node.attrs.iconClear : (this.options.alignMenuIcons?.clear ?? 'x'))
|
|
97
|
-
this.btnView.innerHTML = (this.options.alignMenuIcons?.preview ?? '🔍')
|
|
97
|
+
this.btnView.innerHTML = (node.attrs.iconView != null ? node.attrs.iconView : (this.options.alignMenuIcons?.preview ?? '🔍'))
|
|
98
98
|
this.btnSize50.textContent = '50%'
|
|
99
99
|
this.btnSize100.textContent = '100%'
|
|
100
100
|
|
|
@@ -280,8 +280,7 @@ class ResizableImageView {
|
|
|
280
280
|
this.btnCenter.innerHTML = (node.attrs.iconCenter != null ? node.attrs.iconCenter : (this.options && this.options.alignMenuIcons ? this.options.alignMenuIcons.center : '⇔'))
|
|
281
281
|
this.btnRight.innerHTML = (node.attrs.iconRight != null ? node.attrs.iconRight : (this.options && this.options.alignMenuIcons ? this.options.alignMenuIcons.right : '⟹'))
|
|
282
282
|
this.btnClear.innerHTML = (node.attrs.iconClear != null ? node.attrs.iconClear : (this.options && this.options.alignMenuIcons ? this.options.alignMenuIcons.clear : 'x'))
|
|
283
|
-
if (this.btnView) this.btnView.innerHTML = (this.options && this.options.alignMenuIcons ? this.options.alignMenuIcons.preview : '🔍')
|
|
284
|
-
this.btnView.innerHTML = this.options.iconView ?? '🔍'
|
|
283
|
+
if (this.btnView) this.btnView.innerHTML = (node.attrs.iconView != null ? node.attrs.iconView : (this.options && this.options.alignMenuIcons ? this.options.alignMenuIcons.preview : '🔍'))
|
|
285
284
|
this.aspect = (node.attrs.height && node.attrs.width) ? node.attrs.width / node.attrs.height : this.aspect
|
|
286
285
|
return true
|
|
287
286
|
}
|
|
@@ -358,7 +357,7 @@ export const TiptapIzzyExtensionResizableImage = Node.create({
|
|
|
358
357
|
height: { default: null },
|
|
359
358
|
id: { default: null },
|
|
360
359
|
class: { default: null },
|
|
361
|
-
align: { default:
|
|
360
|
+
align: { default: null },
|
|
362
361
|
showAlignMenu: { default: null },
|
|
363
362
|
alignMenuPosition: { default: null },
|
|
364
363
|
iconLeft: { default: null },
|
|
@@ -394,7 +393,7 @@ export const TiptapIzzyExtensionResizableImage = Node.create({
|
|
|
394
393
|
addCommands() {
|
|
395
394
|
return {
|
|
396
395
|
insertResizableImage:
|
|
397
|
-
({ src, alt, title, width, height }) => ({ commands }) => {
|
|
396
|
+
({ src, alt, title, width, height, id, class: className, iconView }) => ({ commands }) => {
|
|
398
397
|
return commands.insertContent({
|
|
399
398
|
type: this.name,
|
|
400
399
|
attrs: {
|
|
@@ -403,13 +402,15 @@ export const TiptapIzzyExtensionResizableImage = Node.create({
|
|
|
403
402
|
title,
|
|
404
403
|
width,
|
|
405
404
|
height: height != null ? height : this.options.height,
|
|
405
|
+
id,
|
|
406
|
+
class: className,
|
|
406
407
|
showAlignMenu: this.options.showAlignMenu,
|
|
407
408
|
alignMenuPosition: this.options.alignMenuPosition,
|
|
408
409
|
iconLeft: this.options.alignMenuIcons?.left,
|
|
409
410
|
iconCenter: this.options.alignMenuIcons?.center,
|
|
410
411
|
iconRight: this.options.alignMenuIcons?.right,
|
|
411
412
|
iconClear: this.options.alignMenuIcons?.clear,
|
|
412
|
-
iconView: this.options.alignMenuIcons?.preview,
|
|
413
|
+
iconView: iconView != null ? iconView : this.options.alignMenuIcons?.preview,
|
|
413
414
|
},
|
|
414
415
|
})
|
|
415
416
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiptap-extension-izzy-resizable-image",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Resizable image NodeView for TipTap v2 with alignment menu and defaults",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./npm/index.js"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://startinn.github.io/TipTap-Extension-Izzy-Resizable-Image/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/startinn/TipTap-Extension-Izzy-Resizable-Image/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
},
|
|
12
18
|
"files": [
|
|
13
19
|
"npm/index.js",
|
|
14
20
|
"README.md"
|