189 lines
5.4 KiB
Vue
189 lines
5.4 KiB
Vue
|
<template>
|
||
|
<div class="content-section documentation">
|
||
|
<TabView>
|
||
|
<TabPanel header="Documentation">
|
||
|
<h3>Import</h3>
|
||
|
<CodeHighlight lang="javascript">
|
||
|
import Editor from 'primevue/editor';
|
||
|
</CodeHighlight>
|
||
|
|
||
|
<h3>Getting Started</h3>
|
||
|
<p>Two-way value binding is defined with v-model.</p>
|
||
|
<CodeHighlight>
|
||
|
<Editor v-model="value" editorStyle="height: 320px"/>
|
||
|
</CodeHighlight>
|
||
|
|
||
|
<h3>Toolbar</h3>
|
||
|
<p>Editor provides a default toolbar with common options, to customize it define your elements inside the header element. Refer to <a href="http://quilljs.com/docs/modules/toolbar/">Quill documentation</a> for available controls.</p>
|
||
|
<CodeHighlight>
|
||
|
<Editor v-model="value" editorStyle="height: 320px">
|
||
|
<template slot="toolbar">
|
||
|
<span class="ql-formats">
|
||
|
<button class="ql-bold"></button>
|
||
|
<button class="ql-italic"></button>
|
||
|
<button class="ql-underline"></button>
|
||
|
</span>
|
||
|
</template>
|
||
|
</Editor>
|
||
|
</CodeHighlight>
|
||
|
|
||
|
<h3>Properties</h3>
|
||
|
<div class="doc-tablewrapper">
|
||
|
<table class="doc-table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Type</th>
|
||
|
<th>Default</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>value</td>
|
||
|
<td>string</td>
|
||
|
<td>null</td>
|
||
|
<td>Value of the content.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>placeholder</td>
|
||
|
<td>string</td>
|
||
|
<td>null</td>
|
||
|
<td>Placeholder text to show when editor is empty.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>readonly</td>
|
||
|
<td>boolean</td>
|
||
|
<td>false</td>
|
||
|
<td>Whether to instantiate the editor to read-only mode.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>formats</td>
|
||
|
<td>string[]</td>
|
||
|
<td>null</td>
|
||
|
<td>Whitelist of formats to display, see <a href="http://quilljs.com/docs/formats/">here</a> for available options.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>editorStyle</td>
|
||
|
<td>any</td>
|
||
|
<td>null</td>
|
||
|
<td>Inline style of the container.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<h3>Events</h3>
|
||
|
<div class="doc-tablewrapper">
|
||
|
<table class="doc-table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Parameters</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>text-change</td>
|
||
|
<td>event.delta: Representation of the change.<br/>
|
||
|
event.source: Source of change. Will be either "user" or "api".<br/>
|
||
|
event.htmlValue: Current value as html.<br/>
|
||
|
event.textValue: Current value as text.<br/></td>
|
||
|
<td>Callback to invoke when text of editor changes.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>input</td>
|
||
|
<td>event: Current value as html.</td>
|
||
|
<td>Callback to invoke on input event of input field.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<p>Refer to <a href="http://beta.quilljs.com/docs/api/#events">Quill documentation</a> for more information.</p>
|
||
|
|
||
|
<h3>Styling</h3>
|
||
|
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
|
||
|
<div class="doc-tablewrapper">
|
||
|
<table class="doc-table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Element</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>p-editor-container</td>
|
||
|
<td>Container element</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>p-editor-toolbar</td>
|
||
|
<td>Toolbar of the editor</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>p-editor-content</td>
|
||
|
<td>Editable area</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<h3>Dependencies</h3>
|
||
|
<p><a href="http://quilljs.com">Quill</a> Editor 1.3+.</p>
|
||
|
<p>Resources of quill needs to be added to your application.</p>
|
||
|
<CodeHighlight>
|
||
|
npm install quill --save
|
||
|
</CodeHighlight>
|
||
|
</TabPanel>
|
||
|
|
||
|
<TabPanel header="Source">
|
||
|
<a href="https://github.com/primefaces/primevue/tree/master/src/views/inputtext" class="btn-viewsource" target="_blank" rel="noopener noreferrer">
|
||
|
<span>View on GitHub</span>
|
||
|
</a>
|
||
|
<CodeHighlight>
|
||
|
<template v-pre>
|
||
|
<template>
|
||
|
<div>
|
||
|
<div class="content-section introduction">
|
||
|
<div class="feature-intro">
|
||
|
<h1>Editor</h1>
|
||
|
<p>Editor is rich text editor component based on Quill.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="content-section implementation">
|
||
|
<h3 class="first">Default</h3>
|
||
|
<Editor v-model="value1" editorStyle="height: 320px"/>
|
||
|
|
||
|
<h3>Customized</h3>
|
||
|
<Editor v-model="value2" editorStyle="height: 320px">
|
||
|
<template slot="toolbar">
|
||
|
<span class="ql-formats">
|
||
|
<button class="ql-bold"></button>
|
||
|
<button class="ql-italic"></button>
|
||
|
<button class="ql-underline"></button>
|
||
|
</span>
|
||
|
</template>
|
||
|
</Editor>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
</template>
|
||
|
</CodeHighlight>
|
||
|
|
||
|
<CodeHighlight lang="javascript">
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
value1: '<div>Welcome to PrimeVue <b>Editor</b></div><div><br></div>',
|
||
|
value2: ''
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</CodeHighlight>
|
||
|
</TabPanel>
|
||
|
</TabView>
|
||
|
</div>
|
||
|
</template>
|