Editor doc added

pull/12/head
Merve Özçifçi 2019-03-25 14:13:40 +03:00
parent 2253ddf566
commit 93c7f113b7
2 changed files with 196 additions and 0 deletions

View File

@ -22,16 +22,23 @@
</template>
</Editor>
</div>
<EditorDoc />
</div>
</template>
<script>
import EditorDoc from './EditorDoc';
export default {
data() {
return {
value1: '<div>Welcome to PrimeVue <b>Editor</b></div><div><br></div>',
value2: ''
}
},
components: {
'EditorDoc': EditorDoc
}
}
</script>

View File

@ -0,0 +1,189 @@
<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>
&lt;Editor v-model=&quot;value&quot; editorStyle=&quot;height: 320px&quot;/&gt;
</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>
&lt;Editor v-model=&quot;value&quot; editorStyle=&quot;height: 320px&quot;&gt;
&lt;template slot=&quot;toolbar&quot;&gt;
&lt;span class=&quot;ql-formats&quot;&gt;
&lt;button class=&quot;ql-bold&quot;&gt;&lt;/button&gt;
&lt;button class=&quot;ql-italic&quot;&gt;&lt;/button&gt;
&lt;button class=&quot;ql-underline&quot;&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/template&gt;
&lt;/Editor&gt;
</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>
&lt;template&gt;
&lt;div&gt;
&lt;div class=&quot;content-section introduction&quot;&gt;
&lt;div class=&quot;feature-intro&quot;&gt;
&lt;h1&gt;Editor&lt;/h1&gt;
&lt;p&gt;Editor is rich text editor component based on Quill.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;content-section implementation&quot;&gt;
&lt;h3 class=&quot;first&quot;&gt;Default&lt;/h3&gt;
&lt;Editor v-model=&quot;value1&quot; editorStyle=&quot;height: 320px&quot;/&gt;
&lt;h3&gt;Customized&lt;/h3&gt;
&lt;Editor v-model=&quot;value2&quot; editorStyle=&quot;height: 320px&quot;&gt;
&lt;template slot=&quot;toolbar&quot;&gt;
&lt;span class=&quot;ql-formats&quot;&gt;
&lt;button class=&quot;ql-bold&quot;&gt;&lt;/button&gt;
&lt;button class=&quot;ql-italic&quot;&gt;&lt;/button&gt;
&lt;button class=&quot;ql-underline&quot;&gt;&lt;/button&gt;
&lt;/span&gt;
&lt;/template&gt;
&lt;/Editor&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/template&gt;
</template>
</CodeHighlight>
<CodeHighlight lang="javascript">
export default {
data() {
return {
value1: '&lt;div&gt;Welcome to PrimeVue &lt;b&gt;Editor&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;',
value2: ''
}
}
}
</CodeHighlight>
</TabPanel>
</TabView>
</div>
</template>