fix(editor): make initial editor mode (preview/edit) work
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kolaente 2023-11-18 16:54:29 +01:00
parent fa269f155a
commit 6c4f1e1cbf
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 3 additions and 4 deletions

View File

@ -62,7 +62,7 @@
<editor-content <editor-content
class="tiptap__editor" class="tiptap__editor"
:class="{'tiptap__editor-is-empty': isEmpty, 'tiptap__editor-is-edit-enabled': isEditing}" :class="{'tiptap__editor-is-edit-enabled': isEditing}"
:editor="editor" :editor="editor"
/> />
@ -268,7 +268,6 @@ const {
const emit = defineEmits(['update:modelValue', 'save']) const emit = defineEmits(['update:modelValue', 'save'])
const inputHTML = ref('') const inputHTML = ref('')
const isEmpty = computed(() => isEditorContentEmpty(inputHTML.value))
const internalMode = ref<Mode>(initialMode) const internalMode = ref<Mode>(initialMode)
const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled) const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled)
@ -531,7 +530,7 @@ function setFocusToEditor(event) {
} }
} }
.tiptap p.is-empty::before { .tiptap p::before {
content: attr(data-placeholder); content: attr(data-placeholder);
color: var(--grey-400); color: var(--grey-400);
pointer-events: none; pointer-events: none;

View File

@ -25,7 +25,7 @@
v-model="description" v-model="description"
@update:model-value="saveWithDelay" @update:model-value="saveWithDelay"
@save="save" @save="save"
:initial-mode="isEditorContentEmpty(description) ? 'preview' : 'edit'" :initial-mode="isEditorContentEmpty(description) ? 'edit' : 'preview'"
/> />
</div> </div>
</template> </template>