Skip to content

Commit

Permalink
fix(VQuillEditor): disable auto fix cursor by default via `autoFixCur…
Browse files Browse the repository at this point in the history
…sor` prop (#141)
  • Loading branch information
gravitano authored Mar 8, 2023
1 parent d81ceca commit 9a809b6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/quill-editor/src/VQuillEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const props = withDefaults(
labelClass?: string;
errorClass?: string;
hideError?: boolean;
autoFixCursor?: boolean;
}>(),
{
toolbar: 'essential',
Expand All @@ -27,6 +28,7 @@ const props = withDefaults(
readOnly: false,
labelClass: 'block mb-2 font-medium',
errorClass: 'text-sm mt-1 text-error-500',
autoFixCursor: false,
},
);
Expand All @@ -47,15 +49,16 @@ watch(modelValue, (value) => {
watch(
content,
(val: any) => {
editor.value?.setHTML(val);
nextTick(() => {
let q = editor.value?.getQuill();
if (q) {
q.setSelection(val.length, 0, 'api');
q.focus();
}
});
if (props.autoFixCursor) {
editor.value?.setHTML(val);
nextTick(() => {
let q = editor.value?.getQuill();
if (q) {
q.setSelection(val.length, 0, 'api');
q.focus();
}
});
}
},
{immediate: true},
);
Expand Down

0 comments on commit 9a809b6

Please sign in to comment.