mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
feat(HTML Editor): add raw html editor
Allow to copy raw html or paste it from clipboard Fix #1581
This commit is contained in:
1 parent
700cc2a196
commit
d625f622ca
2 files changed
+18
No files matched your search
@@ -33,6 +33,12 @@ const editor = new Editor({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(html, (newHtml) => {
|
||||||
|
if (editor.getHTML() !== newHtml) {
|
||||||
|
editor.commands.setContent(newHtml);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
editor.on('update', ({ editor }) => emit('update:html', editor.getHTML()));
|
editor.on('update', ({ editor }) => emit('update:html', editor.getHTML()));
|
||||||
|
|
||||||
tryOnBeforeUnmount(() => {
|
tryOnBeforeUnmount(() => {
|
||||||
|
|||||||
@@ -24,6 +24,18 @@ const formattedHtml = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<details>
|
||||||
|
<summary>Click here to paste or edit raw html</summary>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="html"
|
||||||
|
multiline raw-text
|
||||||
|
placeholder="Your Html content..."
|
||||||
|
rows="8"
|
||||||
|
autofocus
|
||||||
|
label="Your Html to convert (can paste from clipboard):"
|
||||||
|
paste-html
|
||||||
|
/>
|
||||||
|
</details>
|
||||||
<Editor v-model:html="html" />
|
<Editor v-model:html="html" />
|
||||||
<NSpace justify="center">
|
<NSpace justify="center">
|
||||||
<n-form-item label="Minify:" label-placement="left" mt-2>
|
<n-form-item label="Minify:" label-placement="left" mt-2>
|
||||||
|
|||||||
Reference in new issue
Block a user