add read only example
This commit is contained in:
5
docs/src/demos/ReadOnly/index.spec.js
Normal file
5
docs/src/demos/ReadOnly/index.spec.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
context('read-only', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit('/examples/read-only')
|
||||||
|
})
|
||||||
|
})
|
||||||
55
docs/src/demos/ReadOnly/index.vue
Normal file
55
docs/src/demos/ReadOnly/index.vue
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<template>
|
||||||
|
<div class="editor">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" id="editable" v-model="editable" />
|
||||||
|
<label for="editable">editable</label>
|
||||||
|
</div>
|
||||||
|
<editor-content :editor="editor" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Editor, EditorContent, defaultExtensions } from '@tiptap/vue-starter-kit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EditorContent,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
editable: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.editor = new Editor({
|
||||||
|
editable: false,
|
||||||
|
content: `
|
||||||
|
<h2>
|
||||||
|
Read-Only
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
This text is <strong>read-only</strong>. You are not able to edit something. <a href="https://ueber.io/">Links to fancy websites</a> are still working.
|
||||||
|
</p>
|
||||||
|
`,
|
||||||
|
extensions: defaultExtensions(),
|
||||||
|
})
|
||||||
|
|
||||||
|
window.editor = this.editor
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
editable() {
|
||||||
|
this.editor.setOptions({
|
||||||
|
editable: this.editable,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
3
docs/src/demos/ReadOnly/style.scss
Normal file
3
docs/src/demos/ReadOnly/style.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.checkbox {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
3
docs/src/docPages/examples/read-only.md
Normal file
3
docs/src/docPages/examples/read-only.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Read-Only
|
||||||
|
|
||||||
|
<demo name="ReadOnly" highlight="3-6,22,28,43-49" />
|
||||||
@@ -29,47 +29,47 @@
|
|||||||
- title: Basic
|
- title: Basic
|
||||||
link: /examples/basic
|
link: /examples/basic
|
||||||
- title: Menu Bubble
|
- title: Menu Bubble
|
||||||
link: /Menu Bubble/
|
link: /examples/menu-bubble
|
||||||
- title: Floating Menu
|
- title: Floating Menu
|
||||||
link: /Floating Menu/
|
link: /examples/floating-menu
|
||||||
- title: Links
|
- title: Links
|
||||||
link: /Links/
|
link: /examples/links
|
||||||
- title: Images
|
- title: Images
|
||||||
link: /Images/
|
link: /examples/images
|
||||||
- title: Hiding Menu Bar
|
- title: Hiding Menu Bar
|
||||||
link: /Menu Bar/
|
link: /examples/hiding-menu-bar
|
||||||
- title: Todo List
|
- title: Todo List
|
||||||
link: /Todo List/
|
link: /examples/todo-list
|
||||||
- title: Tables
|
- title: Tables
|
||||||
link: /Tables/
|
link: /examples/tables
|
||||||
- title: Search and Replace
|
- title: Search and Replace
|
||||||
link: /and Replace/
|
link: /examples/search-and-replace
|
||||||
- title: Suggestions
|
- title: Suggestions
|
||||||
link: /Suggestions/
|
link: /examples/suggestions
|
||||||
- title: Markdown Shortcuts
|
- title: Markdown Shortcuts
|
||||||
link: /Markdown Shortcuts/
|
link: /examples/markdown-shortcuts
|
||||||
- title: Code Highlighting
|
- title: Code Highlighting
|
||||||
link: /Code Highlighting/
|
link: /examples/code-highlighting
|
||||||
- title: History
|
- title: History
|
||||||
link: /History/
|
link: /examples/history
|
||||||
- title: Read-Only
|
- title: Read-Only
|
||||||
link: /-Only/
|
link: /examples/read-only
|
||||||
- title: Embeds
|
- title: Embeds
|
||||||
link: /Embeds/
|
link: /examples/embeds
|
||||||
- title: Placeholder
|
- title: Placeholder
|
||||||
link: /Placeholder/
|
link: /examples/placeholder
|
||||||
- title: Focus
|
- title: Focus
|
||||||
link: /Focus/
|
link: /examples/focus
|
||||||
- title: Collaboration
|
- title: Collaboration
|
||||||
link: /Collaboration/
|
link: /examples/collaboration
|
||||||
- title: Title
|
- title: Title
|
||||||
link: /Title/
|
link: /examples/title
|
||||||
- title: Trailing Paragraph
|
- title: Trailing Paragraph
|
||||||
link: /Trailing Paragraph/
|
link: /examples/trailing-paragraph
|
||||||
- title: Drag Handle
|
- title: Drag Handle
|
||||||
link: /Drag Handle/
|
link: /examples/drag-handle
|
||||||
- title: Export HTML or JSON
|
- title: Export HTML or JSON
|
||||||
link: /export-html-or-json/
|
link: /examples/export-html-or-json
|
||||||
|
|
||||||
- title: API
|
- title: API
|
||||||
items:
|
items:
|
||||||
|
|||||||
Reference in New Issue
Block a user