readOnly
This commit is contained in:
parent
5cb4b9aff6
commit
214a840d8a
|
|
@ -12,15 +12,13 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="btn.action(editor)"
|
@click="btn.action(editor)"
|
||||||
:class="{ 'is-active': btn.isActive ? btn.isActive(editor) : false }"
|
:class="{ 'is-active': btn.isActive ? btn.isActive(editor) : false }"
|
||||||
:disabled="btn.disabled ? !btn.disabled(editor) : false"
|
:disabled="readOnly || (btn.disabled ? btn.disabled(editor) : false)"
|
||||||
:title="btn.title"
|
:title="btn.title"
|
||||||
>
|
>
|
||||||
<span class="toolbar-icon">{{ btn.icon }}</span>
|
<span class="toolbar-icon">{{ btn.icon }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- محتوای ادیتور -->
|
|
||||||
<editor-content :editor="editor" class="editor-content" />
|
<editor-content :editor="editor" class="editor-content" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -42,6 +40,10 @@ const props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
readOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const editor = ref(null);
|
const editor = ref(null);
|
||||||
|
|
@ -298,6 +300,7 @@ watch(
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
editor.value = new Editor({
|
editor.value = new Editor({
|
||||||
|
editable: !props.readOnly,
|
||||||
extensions: [
|
extensions: [
|
||||||
StarterKit,
|
StarterKit,
|
||||||
Underline,
|
Underline,
|
||||||
|
|
@ -431,7 +434,7 @@ onBeforeUnmount(() => {
|
||||||
|
|
||||||
.tiptap {
|
.tiptap {
|
||||||
font-family:
|
font-family:
|
||||||
"Vazir",
|
"sahel",
|
||||||
"Inter",
|
"Inter",
|
||||||
-apple-system,
|
-apple-system,
|
||||||
BlinkMacSystemFont,
|
BlinkMacSystemFont,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user