quill

Add custom div to selected/clicked on text with Quill?

此生再无相见时 提交于 2019-12-06 20:46:29
In this demo there's a dropdown with the options "Heading 1", "Heading 2" and "Normal". I'm looking for a way to customize that with my own options (or adding a new button instead of dropdowns) using div classes. For example, I want to add a new option called "myThing" and it turns this: <p>Lorem ipsum dolor sit amet</p> into this: <div class="myThing">Lorem ipsum dolor sit amet</div> How do I do that? You can do this by extending the block blot. As shown in the this section of the Quilljs guides. Just extend the block blot, and set your tag and class name. Example: var Block = Quill.import(

Listen to key press Enter in Quill.js

旧巷老猫 提交于 2019-12-06 12:13:17
问题 According to the documentation, Quill can handle the Enter key but I can't make it work. I have followed these steps listed on their site: Import Keyboard module: const Keyboard = Quill.import('modules/keyboard'); Quill.js Extension import documentation. Add the custom event called key binding. Quill.js Key binding documentation Call a function to handle the event. My code is the following: quill.keyboard.addBinding({ key: Keyboard.keys.ENTER, handler: function(range, context) { console.log(

Upload image on server and add file path inside image tag using quilljs

爷,独闯天下 提交于 2019-12-06 08:16:54
I am using quilljs for my editor. All my data are handle by mysql database. I am using Angularjs 1.x and for backend Cakephp is my frame-work. I am currently trying to build a forum kind of page in which I want to save multiple images along with text which will be formatted using quilljs <p>sd<img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgA....SUVORK5CYII=" alt="i am image"><b>it is image of earth</b></p> This is what currently storing in my database. Now if there is multiple big images come in then size of field will be too much high there for I want to upload image inside severside

Fullscreen button for Quill Editor?

守給你的承諾、 提交于 2019-12-06 02:41:56
问题 I am working with Quill Editor. Its been nice so far. My question is that is there any way to make Quill Editor go full-screen (sort of distraction free mode) by a button in the toolbar? If not than how can I proceed to implement this on my own? 回答1: To go fullscreen I think it is easiest to use a library, for example screenfull.js - https://github.com/sindresorhus/screenfull.js/ As for adding custom buttons to the Quill toolbar, I have found two ways. Method 1: At least simple buttons can be

Include Headings in Quill Rich Editor

核能气质少年 提交于 2019-12-05 20:52:12
I am working on quill rich editor, i need all headings (h1....h6). I have tried different ways but it just shows (h1 and h2) and sometimes it show 3 headings. Html code: <div id="standalone-container"> <div id="toolbar-container"> <span class="ql-formats"> <select class="ql-font"></select> <select class="ql-header"></select> </span> <span class="ql-formats"> <button class="ql-bold"></button> <button class="ql-italic"></button> <button class="ql-underline"></button> <button class="ql-strike"></button> </span> <span class="ql-formats"> <select class="ql-color"></select> <select class="ql

Dynamically change Quill placeholder

耗尽温柔 提交于 2019-12-05 19:27:08
I know that on instantiation of a Quill editor, there is a placeholder option. Is there a way that I can change this placeholder dynamically after the editor is instantiated? The placeholder is implemented with a CSS rule: .ql-editor::before { content: attr(data-placeholder); } So you can do quill.root.dataset.placeholder = 'Your new placeholder'; Shubham Prakash If you are using react-quill The placeholder in the tooltip is coming from the value of the data-link attribute. So you can replace the value with your own when the component finishes mounting. Here is the code: componentDidMount() {

How do I retrieve the contents of a Quill text editor

不问归期 提交于 2019-12-05 16:25:17
问题 I am using the quill text editor in a javascript app and I need to retrieve the contents of the text editor as a string with the HTML included but the docs are a little sparse on this subject. 回答1: Quite simply by accessing the editor's innerHTML: var quill = new Quill('#editor', { theme: 'snow' }); // .... var editor_content = quill.container.innerHTML // or quill.container.firstChild.innerHTML could also work Hope this helps! 回答2: Depends what you want to get, here's an example showing a

How can I disable the Quill editor

依然范特西╮ 提交于 2019-12-05 09:35:49
I have a a template which displays rich text data. When the user clicks edit I turn the template into an editable Quill editor like so: 'click #editNote': (e, t) -> note = t.find '.container' console.log note basicEditor = new Quill(note) Then once the user clicks save I want to be able to disable the Quill editor. How can I do this? This isn't currently documented but you can do this: basicEditor.editor.enable(false) Use this statement var quill = new Quill('#editor-container'); quill.enable(false); Shivanshu Goyal quill.disable() should do the trick. 来源: https://stackoverflow.com/questions

Having problems extending Quill

别等时光非礼了梦想. 提交于 2019-12-05 09:03:21
I'm hitting some problems extending Quill. I want to modify the List and ListItem classes in Quill, so I tried to copy formats/list.js into my code base as a starting point. I then import my local copy and register it with Quill like so... import { List, ListItem } from './quill/list'; Quill.register({ 'formats/list': List, 'formats/list/item': ListItem }, true); However, when I attempt to create a list in the editor the code crashes in the List class with the following error: ParchmentError {message: "[Parchment] Unable to create list-item blot", name: "ParchmentError"} This happens on this

How to access nested template attributes?

折月煮酒 提交于 2019-12-05 07:21:24
问题 I successfully implemented a form with quill wysiwyg but now I want to create a component to reuse it. This is my working implementation: <template name="form"> <form> <div id="toolbar"> ... html with toolbar buttons </div> <div id="editor"></div> <input type="submit" value="save"/> </form> </template> Template.form.rendered = function () { this.quill = new Quill('#editor', { modules: { 'toolbar': { container: '#toolbar' }, 'link-tooltip': true }, theme: 'snow' } ); } Template.form.events({