tiptap-extension-resize-image
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -29,2 +29,8 @@ 'use strict'; | ||
const iconStyle = 'width: 24px; height: 24px; cursor: pointer;'; | ||
const dispatchNodeView = () => { | ||
if (typeof getPos === 'function') { | ||
const newAttrs = Object.assign(Object.assign({}, node.attrs), { style: `${$img.style.cssText}` }); | ||
view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, newAttrs)); | ||
} | ||
}; | ||
const paintPositionContoller = () => { | ||
@@ -45,2 +51,3 @@ const $postionController = document.createElement('div'); | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: flex-start;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -50,2 +57,3 @@ $centerController.addEventListener('click', () => { | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: center;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -55,2 +63,3 @@ $rightController.addEventListener('click', () => { | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: flex-end;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -115,6 +124,3 @@ $postionController.appendChild($leftController); | ||
} | ||
if (typeof getPos === 'function') { | ||
const newAttrs = Object.assign(Object.assign({}, node.attrs), { style: `${$img.style.cssText}` }); | ||
view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, newAttrs)); | ||
} | ||
dispatchNodeView(); | ||
document.removeEventListener('mousemove', onMouseMove); | ||
@@ -121,0 +127,0 @@ document.removeEventListener('mouseup', onMouseUp); |
@@ -25,2 +25,8 @@ import Image from '@tiptap/extension-image'; | ||
const iconStyle = 'width: 24px; height: 24px; cursor: pointer;'; | ||
const dispatchNodeView = () => { | ||
if (typeof getPos === 'function') { | ||
const newAttrs = Object.assign(Object.assign({}, node.attrs), { style: `${$img.style.cssText}` }); | ||
view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, newAttrs)); | ||
} | ||
}; | ||
const paintPositionContoller = () => { | ||
@@ -41,2 +47,3 @@ const $postionController = document.createElement('div'); | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: flex-start;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -46,2 +53,3 @@ $centerController.addEventListener('click', () => { | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: center;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -51,2 +59,3 @@ $rightController.addEventListener('click', () => { | ||
$img.setAttribute('style', `${$img.style.cssText} justify-content: flex-end;`); | ||
dispatchNodeView(); | ||
}); | ||
@@ -111,6 +120,3 @@ $postionController.appendChild($leftController); | ||
} | ||
if (typeof getPos === 'function') { | ||
const newAttrs = Object.assign(Object.assign({}, node.attrs), { style: `${$img.style.cssText}` }); | ||
view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, newAttrs)); | ||
} | ||
dispatchNodeView(); | ||
document.removeEventListener('mousemove', onMouseMove); | ||
@@ -117,0 +123,0 @@ document.removeEventListener('mouseup', onMouseUp); |
{ | ||
"name": "tiptap-extension-resize-image", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A tiptap image resizing extension for React, Vue, Next, and VanillaJS. Additionally, it can align the image position.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48936
301