Did you know that there are almost no lamp posts in Copenhagen? Open Google Maps and see for yourself.
Instead of posts, the city uses lamps suspended over the middle of the road.
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
// import Quill from 'quill'; // SSR problem with 'document', need to use dynamic import
import type Quill from 'quill';
const elemForQuillEditor = ref<HTMLDivElement|null>(null);
let editor: null|Quill = null; // Do not store in ref() - it causes bugs!
// ...
async function createQuillAndSetListeners() {
const Quill = (await import('quill')).default; // This is most important thing - usage of JS dynamic import
if (!elemForQuillEditor.value) return;
editor = new Quill(elemForQuillEditor.value, {
theme: 'snow',
modules: {
history: {
delay: 2000,
maxStack: 500,
userOnly: true,
},
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'],
['link'],
[{ list: 'ordered' }, { list: 'bullet' }],
[{ script: 'sub' }, { script: 'super' }],
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }],
['clean'],
['undo', 'redo'],
],
handlers: {
undo() {
editor?.history.undo();
},
redo() {
editor?.history.redo();
},
},
},
},
placeholder: props.placeholder,
});
editor.on('text-change', () => {
if (!editor) return;
// ... my other code
});
}
// ...
onMounted(createQuillAndSetListeners);
<template>
Some page
</template>
<script lang="ts" setup>
if (1 + 1 === 2) {
await navigateTo('/?abc=1', {
redirectCode: 302,
});
}
if (2 + 2 === 4) {
await navigateTo('/?abc=2', {
redirectCode: 302,
});
}
if (3 + 3 === 6) {
await navigateTo('/?abc=3', {
redirectCode: 302,
});
}
if (4 + 4 === 8) {
await navigateTo('/?abc=4', {
redirectCode: 302,
});
}
</script>
if (1 + 1 === 2) {
await navigateTo('/?abc=1', {
redirectCode: 302,
});
return; // not allowed in script setup
}
let isAlreadyRedirected = false;
if (1 + 1 === 2) {
await navigateTo('/?abc=1', {
redirectCode: 302,
});
isAlreadyRedirected = true;
}
if (!isAlreadyRedirected && 2 + 2 === 4) {
await navigateTo('/?abc=2', {
redirectCode: 302,
});
isAlreadyRedirected = true;
}
if (!isAlreadyRedirected && 3 + 3 === 6) {
await navigateTo('/?abc=3', {
redirectCode: 302,
});
isAlreadyRedirected = true;
}
if (!isAlreadyRedirected && 4 + 4 === 8) {
await navigateTo('/?abc=4', {
redirectCode: 302,
});
isAlreadyRedirected = true;
}
Once again: this is the only thing that solved the problem for me. If you have any other solution, please let me know.