inline-style-editor 1.2.14 → 1.2.16
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 +1 -0
- package/dist/inline-style-editor.css +1 -1
- package/dist/inline-style-editor.js +2 -2
- package/dist/inline-style-editor.js.map +1 -1
- package/dist/inline-style-editor.mjs +285 -221
- package/dist/inline-style-editor.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/style.scss +3 -0
- package/src/components/InlineStyleEditor.svelte +11 -0
- package/src/n +1621 -0
- package/stats.html +1 -1
- package/test.html +6 -2
package/package.json
CHANGED
package/src/assets/style.scss
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
export let listenOnClick = false;
|
|
35
35
|
export let onStyleChanged = () => {};
|
|
36
36
|
export let customProps = {};
|
|
37
|
+
export let inlineDeletable = () => true;
|
|
37
38
|
|
|
38
39
|
const typeText = "text";
|
|
39
40
|
const typeBorder = "border";
|
|
@@ -270,6 +271,7 @@
|
|
|
270
271
|
const popupDimension = self.getBoundingClientRect();
|
|
271
272
|
x = (x + popupDimension.width + 20 > pageDimensions.width) ? x - popupDimension.width - 20: x + 20;
|
|
272
273
|
y = (y + popupDimension.height + 20 > pageDimensions.height) ? y - popupDimension.height - 20 : y + 20;
|
|
274
|
+
y = Math.max(y, 0);
|
|
273
275
|
self.style.left = x + "px";
|
|
274
276
|
self.style.top = y + "px";
|
|
275
277
|
helperElemWrapper.style.display = "block";
|
|
@@ -370,6 +372,10 @@
|
|
|
370
372
|
onStyleChanged(currentElement, currentRule, 'bringtofront', null);
|
|
371
373
|
}
|
|
372
374
|
|
|
375
|
+
function deleteElem() {
|
|
376
|
+
currentElement.remove();
|
|
377
|
+
close();
|
|
378
|
+
}
|
|
373
379
|
function deleteProp(propName) {
|
|
374
380
|
if (currentRule === 'inline') {
|
|
375
381
|
currentElement.style.removeProperty(propName)
|
|
@@ -478,6 +484,11 @@ on:click={overlayClicked}>
|
|
|
478
484
|
Bring to front
|
|
479
485
|
</div>
|
|
480
486
|
{/if}
|
|
487
|
+
{#if currentRule === 'inline' && inlineDeletable(currentElement)}
|
|
488
|
+
<div class="btn delete-elem" on:click="{deleteElem}">
|
|
489
|
+
Delete element
|
|
490
|
+
</div>
|
|
491
|
+
{/if}
|
|
481
492
|
</div>
|
|
482
493
|
{/if}
|
|
483
494
|
</div>
|