GithubHelp home page GithubHelp logo

killercodemonkey / ngx-quill-example Goto Github PK

View Code? Open in Web Editor NEW
212.0 4.0 125.0 33.77 MB

demo app for the advanced usage of ngx-quill module

HTML 28.99% TypeScript 66.37% SCSS 4.63%
ngx-quill quill quilljs angular webpack wysiwyg rich-text-editor editor ng-cli

ngx-quill-example's Introduction

ngx-quill-example

The demo app for the usage of the ngx-quill module. This project was generated with Angular CLI version 17.0.0.

Live Demo

Donate/Support

If you like my work, feel free to support it. Donations to the project are always welcomed :)

PayPal: PayPal.Me/bengtler

Buy Me A Coffee

BTC Wallet Address: 3QVyr2tpRLBCw1kBQ59sTDraV6DTswq8Li

ETH Wallet Address: 0x394d44f3b6e3a4f7b4d44991e7654b0cab4af68f

LTC Wallet Address: MFif769WSZ1g7ReAzzDE7TJVqtkFpmoTyT

Clone, Install and Run

  1. Clone the project then cd into project directory.
  2. Install dependencies with npm install.
  3. Run the development server with ng serve.

View Examples

Navigate in your browser to http://localhost:4200 to view the examples. Each example is implemented as an Angular component.

ngx-quill-example's People

Contributors

depfu[bot] avatar killercodemonkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-quill-example's Issues

@types Iterator not identical

Results of npm run build

[email protected] build C:\Users\Jack\Documents\ang2\ngx-quill-example-master
rimraf ./dist && webpack

keywords if/then/else require v5 option
(node:2480) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic,
see webpack/loader-utils#56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Hash: 96268c6bb8d3b16b3592
Version: webpack 2.1.0-beta.27
Time: 6789ms
Asset Size Chunks Chunk Names
src\app.component.d.ts 328 bytes [emitted]
src\index.d.ts 65 bytes [emitted]
src\polyfills.d.ts 480 bytes [emitted]
src\app.module.d.ts 37 bytes [emitted]
src\main.d.ts 26 bytes [emitted]
app.96268c6bb8d3b16b3592.js 3.5 MB 0 [emitted] app
node_modules\ngx-quill\index.d.ts 37 bytes [emitted]
node_modules\ngx-quill\src\quill.module.d.ts 39 bytes [emitted]
node_modules\ngx-quill\src\quill-editor.component.d.ts 1.91 kB [emitted]
index.html 528 bytes [emitted]
[331] ./src async 160 bytes {0} [built]
+ 601 hidden modules

ERROR in [default] C:\Users\Jack\Documents\ang2\ngx-quill-example-master\node_modules@types\node\index.d.ts:50:13
All declarations of 'iterator' must have identical modifiers.


0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\Jack\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]prebuild: [email protected]
6 silly lifecycle [email protected]
prebuild: no script for prebuild, continuing
7 info lifecycle [email protected]build: [email protected]
8 verbose lifecycle [email protected]
build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]build: PATH: C:\Users\Jack\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\Jack\Documents\ang2\ngx-quill-example-master\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Git\cmd;C:\Users\Jack\AppData\Roaming\npm\node_modules\compass;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\Doctrine extensions for PHP;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\Skype\Phone;C:\Program Files\Git\cmd;C:\Go\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Users\Jack\AppData\Local\Android\android-sdk\tools;C:\Users\Jack\AppData\Local\Android\android-sdk\platform-tools;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs;C:\Users\Jack\AppData\Roaming\npm\node_modules\compass;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Jack\AppData\Local.meteor;C:\Go\bin;C:\Users\Jack\AppData\Local\Microsoft\WindowsApps;C:\Users\Jack\AppData\Local\Yarn.bin;C:\Users\Jack\AppData\Roaming\npm
10 verbose lifecycle [email protected]
build: CWD: C:\Users\Jack\Documents\ang2\ngx-quill-example-master
11 silly lifecycle [email protected]build: Args: [ '/d /s /c', 'rimraf ./dist && webpack' ]
12 silly lifecycle [email protected]
build: Returned: code: 2 signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: rimraf ./dist && webpack
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (C:\Users\Jack\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Users\Jack\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\Jack\Documents\ang2\ngx-quill-example-master
17 verbose Windows_NT 10.0.14393
18 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\Jack\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "build"
19 verbose node v6.10.0
20 verbose npm v4.4.1
21 error code ELIFECYCLE
22 error errno 2
23 error [email protected] build: rimraf ./dist && webpack
23 error Exit status 2
24 error Failed at the [email protected] build script 'rimraf ./dist && webpack'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the exmplate-ngx-quill package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error rimraf ./dist && webpack
24 error You can get information on how to open an issue for this project with:
24 error npm bugs exmplate-ngx-quill
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls exmplate-ngx-quill
24 error There is likely additional logging output above.
25 verbose exit [ 2, true ]

load html content is not correctly shown in quill-editor

hello .
i can't solve this problem.
#512 (comment)
then i question more.

this is my code.

.html

<quill-editor
                  (onEditorCreated)="getEditorInstance($event)"
                  [theme]="'snow'"
                  [format]="'html'"
                  [modules]="isView ? {toolbar : false} : { toolbar: [ [{ 'font': [] }], [{ 'header': 1 }, { 'header': 2 }],  [{ 'size': ['small', false, 'large', 'huge'] }],  [{ 'color': [] }, { 'background': [] }], ['bold', 'italic', 'underline', 'strike'],   [{ 'align': [] }],['blockquote', 'code-block'], [{ 'list': 'ordered'}, { 'list': 'bullet' }], ['image', 'link']] }"
                  [placeholder]="'insert text"
                  [style]="{'padding-right': '4px', 'padding-bottom': '4px', 'height': '200px', 'min-height': '200px', 'overflow-y': 'visible', 'resize': 'vertical', 'min-height': '200px'}"
                  [bounds]="'self'"
                  formControlName= "content">
                </quill-editor>

load content to below.
formControlName= "content" is contains
content: "<p>test</p><p>testtest</p><p>test</p>"

i see in console.log() in getEditorInstance function, console.log is ...
editor > "delta" is shown.

if i convert delta to html , is it shown in editor correctly?
if correctly, how can i set html editor?
i wait your comment. 🙏

스크린샷 2020-10-08 오전 11 23 38

getEditorInstance funtion is contains this code.


getEditorInstance(editorInstance) {
    **console.log('quill>>',editorInstance);** // <- i print log here
    if (!this.isView) {
      const toolbar = editorInstance.getModule('toolbar');
      toolbar.addHandler('image', (_) => {
        const input = document.createElement('input');
        input.setAttribute('type', 'file');
        input.setAttribute('accept', 'image/*');
        input.click();
        this.renderer.listen(input, 'change', (evt) => {
          const f: File = evt.path[0].files[0];
          const reader = new FileReader();
          reader.onload = (evt2: ProgressEvent) => {
            if (f) {
              this.uploadImage(editorInstance, f);
            } else {
              this.modalService.confirm({
                ...
              });
            }
          };
          reader.readAsDataURL(f);

        });
      });
    }
  }

Font Styles

Is there any way to add more font styles in it. Because by default there are only three (sans, sans serif and monospace). I want to add styles like Arial, Times New Roman etc.

using custom dropdown with all the default functionalities(bold,italic, etc)

Hi ,

can we use custom dropdown as toolbar and default functionality at the same time .

facing issue while using both
vendor.js:284653 quill:toolbar ignoring attaching to nonexistent format ee <select class=​"ql-ee" style=​"display:​ none;​">​…​​<option value=​"22">​​​
debug @ vendor.js:284653

as warning message and not binding the data into it.
in ts file (angular 8) :
modules = {
formula: false,
toolbar:
{
container:
[
['bold', 'italic', 'underline', 'strike'], // toggled buttons
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],

  ['clean'],                                         // remove formatting button

  ['link', 'image', 'video']    ,
 [{ 'ee': ['22'] }],  // my dropdown
],
handlers: {
  'customControl': () => { console.log('customControl was clicked') }
}

}
};

<quill-editor formControlName="mailHtml" [modules]="modules" [styles]="{height: '200px'}"

  (onEditorChanged)="changedEditor($event)">
 
</quill-editor>

Extract mat-quill to a separate npm package

Even though there's a lot of examples that use the mat-quill component, it's not easily accessible for use in other projects. Anyone who wants to use the mat-quill component has to copy-paste the code from mat-quill-base.ts, mat-quill.ts, mat-quill.module.ts into their own project. But even then, due to code complexity, the developer will face multiple issues like #673 and #421.

Seems like using quill in angular+material environment is quite a popular scenario, so a lot of people would benefit from having a separate component just works out of the box, just like the examples do.

There's also an npm package whose name implies that it would do exactly that, but it seems to be just a clone of the original package without any changes: https://www.npmjs.com/package/ngx-quill-material

Thanks a lot for your work!

Hindi language compatibility

I want to use the Hindi language in quill but it shows wired behaviour when pasting Hindi text from Word document to Quill Editor
image
https://stackblitz.com/edit/angular-ivy-rvwurm?file=src/app/app.component.ts

इसके बाद तिब्बत की सबसे खतरनाक जगह डाँड़ा थोङ्ला पार करना था।
सोलह-सत्रह हज़ार फिट की ऊँचाई होने के कारण उनके दोनों तरफ़ मीलों तक कोई गाँव नहीं था।
चढ़ाई कठिन तथा पड़ाव दूर होने के कारण लेखक ने घोड़े का इंतजाम करवाया।
दूसरे दिन लेखक और उनके साथी घोड़ों पर सवार होकर चल पड़े और दोपहर के वक्त डाँड़े के ऊपर जा पहुँचे।
लेखक समुद्रतल से 17-18 हज़ार फीट ऊँचाई पर खड़े थे, तथा दक्खिन तरफ़ पूरब से पच्छिम की ओर हिमालय के हज़ारों श्वेत शिखर थे।
भीटे की ओर दिखने वाले पहाड़ बिलकुल नंगे थे, न बरफ़ न हरियाली।
उत्तर की तरफ़ बहुत कम बरफ़ वाली चोटियाँ दिखाई पड़ती थीं।
सबसे ऊपर, पत्थरों के ढेर, जानवरों की सींगों और रंग-बिरंगे कपड़े की झंडियों से सजा स्थान, डाँड़े के देवता का था।

This is the actual text which gets jumbled when paste in quill editor.
Also when using bullet points it ignored the last sentence.

Please help me out with this issue Thanks

Module '"quill"' has no default export

I'm trying to implement your exemple in my cli project

I get the following error due to import Quill from 'quill';
Module '"quill"' has no default export

I add the scripts in my angular.json

        "scripts": [
           ...
            "./node_modules/ngx-quill/bundles/ngx-quill.umd.js",
            "./node_modules/quill/dist/quill.js",
            ...
          ],

How to display editor data in HTML

I have saved the data typed in the editor to my database and it gets saved in a HTML format with tags. Now, when I'm trying to display that data in my HTML it comes along with those HTML tags. How I can remove those tags and show only the data.

Reset toolbar

Hi,
Is there a way to reset the toolbar manually?
When the code button is activated and the content changes dynamically, all content is formatted in code.

Precompile code for GitHub pages

I think it would be nice if you precompiled the code and created a GH pages branch, so people can view the project without having to download and compile it themselves. I think this would be really nice, because it's an example application, so if people could view it immediately in their browser it would be very handy.

This is just an idea, if you disagree that's fine too.

Previous data was not retained in correct format which I had saved before in the form. It should be retained correctly in the form so that user can see the saved data then tries to edit and save the form.

Intalled:
"quill": "^1.3.7",
"quill-emoji": "^0.2.0",
"quill-mention": "^3.0.3",
"ngx-quill": "^13.3.1"

Configured Css:

         "styles": [
            "node_modules/quill/dist/quill.core.css",
            "node_modules/quill/dist/quill.bubble.css",
            "node_modules/quill/dist/quill.snow.css"
          ],
          "scripts": [
              "node_modules/quill/dist/quill.js"
          ]

Imported the Module:

  QuillModule.forRoot()

Problem:
I was working on the large form with more than 100 fields. In that, I was using the ngx-quill library to use editor field, everything was working fine but the data was not retained in the correct format. For example, If I used the right align, center align and left align in three lines means it comes in single line. That is not what I have saved before. Please help me out with this scenario. Below is my code,

import { Component, OnInit } from '@angular/core';
import { FieldType } from '@ngx-formly/core';
import 'quill-mention';
import 'quill-emoji';

@component({
selector: 'quill-editor',
template: <quill-editor [(ngModel)]="htmlText" placeholder="Enter Text" [modules]="quillConfig" (onSelectionChanged)="onSelectionChanged($event)" (onContentChanged)="onContentChanged($event)" [styles]="{height: '50px'}"></quill-editor>,
styleUrls: ['./custom-fields.css']
})
export class QuillEditorComponent extends FieldType {
htmlText ="<ol><li><strong>Heading </strong></li><li><em>Italic </em></li><li><u>Underlined </u></li></ol><p><br></p><ul><li><span style=\"color: rgb(230, 0, 0);\">Colour </span></li><li><span style=\"background-color: rgb(0, 138, 0);\">Background-colour </span></li><li><a href=\"Link\" rel=\"noopener noreferrer\" target=\"_blank\">Link</a></li></ul><p><br></p><p class=\"ql-align-right\">Right Align</p><p>Left Align</p><p class=\"ql-align-center\">Justify</p>"
hasFocus = false;
subject: string;

atValues = [
{ id: 1, value: 'Fredrik Sundqvist', link: 'https://google.com' },
{ id: 2, value: 'Patrik Sjölin' }
];
hashValues = [
{ id: 3, value: 'Fredrik Sundqvist 2' },
{ id: 4, value: 'Patrik Sjölin 2' }
]

quillConfig={
//toolbar: '.toolbar',
toolbar: {
container: [
['bold', 'italic', 'underline'], // toggled buttons
[{ 'color': [] }, { 'background': [] }],
['link'],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'align': [] }],
// ['code-block'],
// [{ 'header': 1 }, { 'header': 2 }], // custom button values

    //[{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
    //[{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
    //[{ 'direction': 'rtl' }],                         // text direction

    //[{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
    //[{ 'header': [1, 2, 3, 4, 5, 6, false] }],

    //[{ 'font': [] }],
    //[{ 'align': [] }],

    //['clean'],                                         // remove formatting button

    
    //['link', 'image', 'video']  
  ],
  
},

mention: {
  allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
  mentionDenotationChars: ["@", "#"],
  source: (searchTerm, renderList, mentionChar) => {
    let values;

    if (mentionChar === "@") {
      values = this.atValues;
    } else {
      values = this.hashValues;
    }
    
    if (searchTerm.length === 0) {
      renderList(values, searchTerm);
    } else {
      const matches = [];
      for (var i = 0; i < values.length; i++)
        if (~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase())) matches.push(values[i]);
      renderList(matches, searchTerm);
    }
  },
},
"emoji-toolbar": true,
"emoji-textarea": false,
"emoji-shortname": true,
keyboard: {
  bindings: {
    // shiftEnter: {
    //   key: 13,
    //   shiftKey: true,
    //   handler: (range, context) => {
    //     // Handle shift+enter
    //     console.log("shift+enter")
    //   }
    // },
    enter:{
      key:13,
      handler: (range, context)=>{
        console.log("enter");
        return true;
      }
    }
  }
}

}

test=(event)=>{
console.log(event.keyCode);
}

onSelectionChanged = (event) =>{
if(event.oldRange == null){
this.onFocus();
}
if(event.range == null){
this.onBlur();
}
}

onContentChanged = (event) =>{
//console.log(event.html);
}

onFocus = () =>{
console.log("On Focus");
}
onBlur = () =>{
console.log("Blurred");
}
}

example no work with angular cli 6.

there are many errors this example with angular cli 6.

Please, could you update this example with angular 6 or make a new example for angular cli 6

Thank you in advance for your help !!!

Regards,
Frank

Saving editor text

hi, Thanks for directing me to detailed example @KillerCodeMonkey.

I am trying to save the editor text when the user clicks on a button; that's on a toolbar.
I added the button and click listener/handler.

When I click the button the editor object is null in my component. i suspect its angular lifecycle issue but if there is a way to accomplish this using the toolbar APIs please let me know.

StackBlitz

image

How do I reset the quill delta

Angular 4 reactive forms w/ quill I'm having issues with patching in rich text into the quill editor. The problems don't happen the first time but on subsequent patches on the same form it will strip out

tags and such inside the body

I don't have an easy way to reproduce this to show you but maybe this description will give me a hint how I can reset the quill delta between form loads

edit: sorry this should probably be in the main repo

Handle inline css stying withing HTML

Hi,
Thanks for the library. I want quill to handle large html file with inline styling, I am having an issue where some of the styling is not working, for instance text-decoration:underline:

<p style="margin-top:0pt; margin-bottom:8pt; font-size:0.83em">
			<a name="_WCvcc_1_dd_XC__3_60690d_60690d_60690d"><span style="font-family:Georgia; font-weight:bold; text-decoration:underline">SCOPE OF  SERVICES, DELIVERABLES, AND TIMING.</span></a>

Any assistance is appreciated,

Contribute proposition

Hi @KillerCodeMonkey

Would you like me to add a more complex exemple ?
I never used quill before I ran into your ngx-quill lib (which is awesome) and faced some issues with quill to make custom toolbar and create Attributors because there is not a lot of docs.

If you're ok with it, how would you like me to contribute ?
A new folder to separate completely the exemple and handle dependancies otherwise or should I limit the exemple in functionalities to fit in your src/app/componentXXXX ?

👍 for your work and quick reply on every issues !

Quill Editor : Check for change in content in Angular?

I have implemented quill editor in Angular by creating new instance of quill and creating custom toolbar.

this.quill = new Quill('#editor-container', {
    modules: {
        toolbar: '#toolbar-container'
    },
    theme: 'snow' // or 'bubble'
});

I have a "update" button which would call the update API. I need to check if the contents of the Quill editor has changed. I am aware of quill.on('text-change'):

this.quill.on('text-change', function(delta, oldDelta, source) {
    if (source == 'api') {
        console.log('An API call triggered this change.');
    } else if (source == 'user') {
        console.log('A user action triggered this change.');
    }
});

However, I am not sure where do I place this? NgOnInit? NgAfterViewInit? I have created the quill instance in ngAfterViewInit. I know this could be a dumb question.

Any help appreciated! thanks! :)

For those who need help with the toolbar list, here it is ;)

<div quill-editor-toolbar>
    <span class="ql-formats">
      <button type="button" class="ql-bold"></button>
      <button type="button" class="ql-italic"></button>
      <button type="button" class="ql-underline"></button>
      <button type="button" class="ql-strike"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-blockquote"></button>
      <button type="button" class="ql-code-block"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-header" value="1"></button>
      <button type="button" class="ql-header" value="2"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-list" value="ordered"></button>
      <button type="button" class="ql-list" value="bullet"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-script" value="sub"></button>
      <button type="button" class="ql-script" value="super"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-indent" value="-1"></button>
      <button type="button" class="ql-indent" value="+1"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-direction" value="rtl"></button>
   </span>
    <span class="ql-formats">
      <select class="ql-size">
         <option value="small"></option>
         <option selected="selected"></option>
         <option value="large"></option>
         <option value="huge"></option>
      </select>
   </span>
    <span class="ql-formats">
      <select class="ql-header">
         <option value="1"></option>
         <option value="2"></option>
         <option value="3"></option>
         <option value="4"></option>
         <option value="5"></option>
         <option value="6"></option>
         <option selected="selected"></option>
      </select>
   </span>
    <span class="ql-formats">
      <select class="ql-color">
         <option selected="selected"></option>
         <option value="#e60000"></option>
         <option value="#ff9900"></option>
         <option value="#ffff00"></option>
         <option value="#008a00"></option>
         <option value="#0066cc"></option>
         <option value="#9933ff"></option>
         <option value="#ffffff"></option>
         <option value="#facccc"></option>
         <option value="#ffebcc"></option>
         <option value="#ffffcc"></option>
         <option value="#cce8cc"></option>
         <option value="#cce0f5"></option>
         <option value="#ebd6ff"></option>
         <option value="#bbbbbb"></option>
         <option value="#f06666"></option>
         <option value="#ffc266"></option>
         <option value="#ffff66"></option>
         <option value="#66b966"></option>
         <option value="#66a3e0"></option>
         <option value="#c285ff"></option>
         <option value="#888888"></option>
         <option value="#a10000"></option>
         <option value="#b26b00"></option>
         <option value="#b2b200"></option>
         <option value="#006100"></option>
         <option value="#0047b2"></option>
         <option value="#6b24b2"></option>
         <option value="#444444"></option>
         <option value="#5c0000"></option>
         <option value="#663d00"></option>
         <option value="#666600"></option>
         <option value="#003700"></option>
         <option value="#002966"></option>
         <option value="#3d1466"></option>
      </select>
      <select class="ql-background">
         <option value="#000000"></option>
         <option value="#e60000"></option>
         <option value="#ff9900"></option>
         <option value="#ffff00"></option>
         <option value="#008a00"></option>
         <option value="#0066cc"></option>
         <option value="#9933ff"></option>
         <option selected="selected"></option>
         <option value="#facccc"></option>
         <option value="#ffebcc"></option>
         <option value="#ffffcc"></option>
         <option value="#cce8cc"></option>
         <option value="#cce0f5"></option>
         <option value="#ebd6ff"></option>
         <option value="#bbbbbb"></option>
         <option value="#f06666"></option>
         <option value="#ffc266"></option>
         <option value="#ffff66"></option>
         <option value="#66b966"></option>
         <option value="#66a3e0"></option>
         <option value="#c285ff"></option>
         <option value="#888888"></option>
         <option value="#a10000"></option>
         <option value="#b26b00"></option>
         <option value="#b2b200"></option>
         <option value="#006100"></option>
         <option value="#0047b2"></option>
         <option value="#6b24b2"></option>
         <option value="#444444"></option>
         <option value="#5c0000"></option>
         <option value="#663d00"></option>
         <option value="#666600"></option>
         <option value="#003700"></option>
         <option value="#002966"></option>
         <option value="#3d1466"></option>
      </select>
   </span>
    <span class="ql-formats">
      <select class="ql-font">
         <option selected="selected"></option>
         <option value="serif"></option>
         <option value="monospace"></option>
      </select>
   </span>
    <span class="ql-formats">
      <select class="ql-align">
         <option selected="selected"></option>
         <option value="center"></option>
         <option value="right"></option>
         <option value="justify"></option>
      </select>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-clean"></button>
   </span>
    <span class="ql-formats">
      <button type="button" class="ql-link"></button>
      <button type="button" class="ql-image"></button>
      <button type="button" class="ql-video"></button>
   </span>
</div>

The examples are not working in ngx-quill 14.3.0.

super(
injector, elementRef, domSanitizer, platformId,
renderer, zone, service
)

It is working in ngx-quill 13.0.0 but not ngx-quill 14.3.0.
mat-quill-base.ts:error TS2554: Expected 8 arguments, but got 7.

can not import ImageResize from 'quill-image-resize-module'

Hello, I am using angular4. Do I need npm install quill-image-resize-module before starting? After installation, I can't import ImageResize from 'quill-image-resize-module'; it says Could not find a declaration file for module 'quill-image-resize-module'. 'C:/Users/Ying/Desktop/work /node_modules/quill-image-resize-module/image-resize.min.js' implicitly has an 'any' type.

Triggering bold method manually

Hi there,

I opened a ticket for this yesterday but I think it has been removed. You told me to ask quill js team as this is only a wrapper, and I saw in their doc that they have this functionality, see this link:https://quilljs.com/docs/api/#formatting

So, it would be like: quill.formatText(0, 5, 'bold', true); // bolds 'hello'
I am asking if you as the author of this lib if you have exposed this through the lib api, as I didn't see it but I might missed it.

Thanks,

Dropdown issue when overlapping next text field

When using the bubble version of the editor, if the dropdown options are going over the next input field, it's impossible to select the option. Somehow, the input field is the one taking the click, and not the dropdown

onPaste scroll move to top

I tried different workaround this but it's not fixed ,pasting here the code which cause the issue and it's known bug.
`{
key: 'onPaste',
value: function onPaste(e) {
var _this2 = this;

  if (e.defaultPrevented || !this.quill.isEnabled()) return;
  var range = this.quill.getSelection();
  var delta = new _quillDelta2.default().retain(range.index);
  var scrollTop = this.quill.scrollingContainer.scrollTop;
  this.container.focus();
  this.quill.selection.update(_quill2.default.sources.SILENT);
  setTimeout(function () {
    delta = delta.concat(_this2.convert()).delete(range.length);
    _this2.quill.updateContents(delta, _quill2.default.sources.USER);
    // range.length contributes to delta.length()
    _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
    _this2.quill.scrollingContainer.scrollTop = scrollTop;
    _this2.quill.focus();
  }, 1);
}

}`

how can i overwrite this code which is present inside quill.js

How to embed getty images

How do I embed getty images in the editor. When i try to embed using tag property it shows embedded code as a code rather than showing it as a image.

Enter key begin in same line = CSS issue

Hi team,
I have an issue. When I click on ENTER key in Quill-Editor, dont new line, begin start in the same line...I know It's an issue with CSS, but could you help me?....

Set fromat

Hi,

I did not quite understand the example.
How can I force for example align to center to always be used?
Also, how can I set default values, like bold on per default?

Br

Lazy-load Highlight.js for Quill Syntax Module in Lazy-Loaded Angular Module?

This example project shows loading the Highlight.js script and its CSS in index.html. We are using ngx-quill in lazy-loaded modules and would prefer to lazy-load HighlightJS, as well, in order to optimize application load time. However, our attempts to do so have failed. We always get the error 'Syntax module requires highlight.js. Please include the library on the page before Quill.' when configuring syntax: true. Any tips on lazy-loading Highlight.js?

How to import QuillModule in an Angular Library correctly?

I wrote my own Angular @Mention component/module that wraps around <quill-editor> in an Angular Lib using Nx. In my Lib module, I am importing QuillModule.forRoot(). However, given I am going to be importing this module and consuming it in feature modules (not the root application module), I am wondering if this is correct? Should I import QuillModule.forRoot() in my root app module for any app that will be using my Mention Lib and use the child injection token and import QuillModule normally in my Mention Lib instead? Hopefully that makes sense. Thank you in advance! Also, kudos for a rad library.

How to work with input properties.?

Thank you for such an amazing project.

I've implemented ngx-quill angular material form control version. There are multitude of input properties like minLength, maxLength and trimOnValidation which works with default quill-editor but are not working on mat-quill.

I've seen disabled mixin been created but not sure what is ideology behind it. I want to extend all the basic functionality of inputs in quill-editor to mat-editor.

Whenever I try to integrate quill-better-table with ngx-quill, I get the same errors saying cannot import modules/table, and it is not registered by Quill . How do I tackle this problem ?

import {ViewChild, Component, OnInit} from '@angular/core';
import { QuillEditorComponent } from 'ngx-quill';
import QuillCursors from 'quill-cursors';
import Quill from 'quill';
import 'quill-mention';
import QuillBetterTable from "quill-better-table";
import ImageResize  from 'quill-image-resize';

Quill.register('modules/better-table',QuillBetterTable);
Quill.register('modules/cursors', QuillCursors); 
Quill.register({'modules/imageResize' : ImageResize},true);

@Component({
  selector: 'app-editor',
  templateUrl: './editor.component.html',
  styleUrls: ['./editor.component.css']
})

export class EditorComponent implements OnInit{
  @ViewChild(QuillEditorComponent, { static: true })
  editor: QuillEditorComponent;
  content = '';
  public modules: any;
  private token: any;
  private cursor: any;
  private cursorModule: any;
  ngOnInit(){
  }

  constructor()
  {
    this.modules = {
      cursors: {
        hideDelayMs: 5000,
        hideSpeedMs: 1000,
        transformOnTextChange: true
      },
      imageResize: {},
      mention: {
        allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
        onSelect: (item, insertItem) => {
          const editor = this.editor.quillEditor as Quill
          insertItem(item) // necessary because quill-mention triggers changes as 'api' instead of 'user'
          editor.insertText(editor.getLength() - 1, '', 'user')
        },
        source: (searchTerm, renderList) => {
          const values = [
            { id: 1, value: 'Alec'},
            { id: 2, value: 'Irshad'},
            { id: 3, value: 'Anmol'},
            { id: 4, value: 'MunMun'},
            { id: 5, value:'Zoya'}
          ]
          if (searchTerm.length === 0) {
            renderList(values, searchTerm)
          } else {
            const matches = []
            values.forEach((entry) => {
              if (entry.value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1) {
                matches.push(entry)
              }
            })
            renderList(matches, searchTerm)
          }
        }
      },
      table: false, // disable table module
      "better-table": {
        operationMenu: {
          items: {
            unmergeCells: {
              text: "Another unmerge cells name"
            }
          },
          color: {
            colors: ["#fff", "red", "rgb(0, 0, 0)"], // colors in operationMenu
            text: "Background Colors" // subtitle
          }
        }
      },
      keyboard: {
        bindings: QuillBetterTable.keyboardBindings
      }
    }     
  }

some prblems

Hi,
i have some problems in my project:

  1. i have a lot of errors in my console from this type: _co.created, _co.changedEditor, _co.focus ...
    how can i solve this?
  2. if there are some editable elements in the page that i want that the quill editor will work on them how can i define it?

mat-quill not accepting module input

Hi,

I have reached a difficulty in integrating into my application as a custom form control.

I am basing the integration on the custom-toolbar example. Its probably a Newbie mistake but when trying to bind to the modules input using the code below the modules input is not found.

<mat-quill customToolbarPosition="bottom" [(ngModel)]="editorModel" format="object" [modules]="{ counter: { container: '#mat-quill-counter', unit: 'word' } }" >
The error I receive is:

If 'mat-quill' is an Angular component and it has 'modules' input, then verify that it is part of this module.

If I remove the [modules] binding then the error is no longer generated. Does anyone know whether there is anything in particular I should be verifying.

Thanks.

Paul

SSR document is not defined error

I am trying to create and register some custom modules and I keep getting "document is not defined" error from the server.
Using angular universal, angular 11, ngx-quill 13

I am importing Quill in to the component., and the variable assignment line is producing the error.

import * as QuillNamespace from 'quill';
// let Quill: any = QuillNamespace; <------ this errors on the server

p tag is not shown line break in <quill-editor>

i using the tag.

i enter the 2 string include enter key.

e.x)
one line (push enter key)
two line

it is save the <p>one line</p><p>two line</p> in database.

then i call this content at <quill-editor>, it is not shown the line break.
expected show:
one line
two line

but editor is shown:
one linetwo line (but api resonse is

one line

two line

how fix this problem?

Argument of type 'ElementRef<any>' is not assignable to parameter of type 'Injector'. Property 'get' is missing in type 'ElementRef<any>' but required in type 'Injector'.

Hi, recently I installed ngx-quill and extends the QuillEditorBase to implement a mat-form-field that supports reactive forms with error handling.

Im facing a issue related with the extension of quill-base-editor, locally i dont have issues but when i upload my application to Azure Static Website y made a build and i has this output:
image

I followed the guides to extend a matformcontrol: https://github.com/KillerCodeMonkey/ngx-quill-example/tree/master/src/app/mat-quill.

Which could be the error?

Regards

Custom Modules, using Quill.register() saying cannot read property 'register' of undefined

Hello again.
Now that I've gotten the editor functionally working, I wanted to try and create a custom module.

When following the strict QuillJS documentation failed, I started working from your ngx-quill example again. While I got close I ran into problems when actually trying to do anything with importing, registering or defining the module. I couldn't get ImageResize to work on my end even though I did install the module in node_modules. The import simply would not recognize the ImageResize, so the rest of functionality could not be implemented or even really attempted.

I then turned to your counter example as it was more closely related to what I wanted to actually do. However, even with your example which shows exactly what to type and the QuillJS documentation I cannot get it to work for the life of me. I got it to work so that the import line worked and everything seemingly compiles in command prompt. But the page itself doesn't actually display anything when I go in my browser, so obviously something is incorrect. I've looked at other people opening issues and tried working through their supposed solutions but just can't get it. After a couple days, I thought I would just ask because it seems like you know how to simply do it and I am most likely missing something pretty dumb. This is everything I have that works and displays a working page in the browser. It may have something to do with parchment perhaps I also could not get that to work for me.

So sorry for the pestering, any help would greatly appreciated. Just want to say thank you and that this repository I have to say is pretty darn amazing sir.

capture

editor.component.ts

import {Component, ElementRef, OnInit, ViewChild, ViewEncapsulation, ViewContainerRef, ComponentFactoryResolver} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {Observable} from 'rxjs/Observable';

import {QuillEditorComponent} from 'ngx-quill/src/quill-editor.component';
import {AutocompleteBoxComponent} from '../autocomplete-box/autocomplete-box.component';

import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';

import Quill from 'quill';

// import Counter from './counter';
// Quill.register('modules/counter', Counter);

// // // add image resize module
// import ImageResize from 'quill-image-resize-module';
// Quill.register('modules/imageResize', ImageResize);

// // override p with div tag
// const Parchment = Quill.import('parchment');
// const Block = Parchment.query('block');


@Component({
  selector: 'app-editor',
  templateUrl: './editor.component.html',
  styleUrls: ['./editor.component.scss'],
  encapsulation: ViewEncapsulation.None
})


export class EditorComponent implements OnInit {

  title = '<ul><li>I am example content</li><li><u>And this, too</u></li></ul>';
  isReadOnly = false;
  placeholder = 'placeholder';
  form: FormGroup;
  modules = {};

  constructor(fb: FormBuilder) {
    this.form = fb.group({
      editor: ['test']
    });

    this.modules = {
      formula: true,
      toolbar: [['formula'], ['image']]
    };
  }

  @ViewChild('editor') editor: QuillEditorComponent;

  ngOnInit() {
    this.form
      .controls
      .editor
      .valueChanges
      .debounceTime(400)
      .distinctUntilChanged()
      .subscribe(data => {
        console.log('native fromControl value changes with debounce', data);
      });

    this.editor
      .onContentChanged.debounceTime(400)
      .distinctUntilChanged()
      .subscribe(data => {
        console.log('view child + directly subscription', data);
      });
  }


  setControl() {
    this.form.setControl('editor', new FormControl('test - new Control'));
  }

  setFocus($event) {
    $event.focus();
  }

  patchValue() {
    this.form.controls['editor'].patchValue(`${this.form.controls['editor'].value} patched!`);
  }

  toggleReadOnly() {
    this.isReadOnly = !this.isReadOnly;
  }

  logChange($event: any) {
    console.log($event);
  }

  logSelection($event: any) {
    console.log($event);
  }

}

editor.component.html

<h3>Default editor</h3>
<quill-editor [style]="{height: '200px'}" (onEditorCreated)="setFocus($event)"></quill-editor>

<h3>Reactive Forms and patch value</h3>
<button type="button" (click)="hide=!(!!hide)">hide / show</button>
<form [formGroup]="form">
  {{form.controls.editor.value}}
  <button type="button" (click)="patchValue()">patchValue</button>
  <button type="button" (click)="setControl()">setControl</button>

  <quill-editor #editor [style.display]="hide ? 'none' : 'block'"
                [formControl]="form.controls['editor']"></quill-editor>
</form>

<!--<h3>Formula & image resize editor & Keybinding on 'b'</h3>-->
<!--<quill-editor #editor [modules]="modules" (onEditorCreated)="addBindingCreated($event)"></quill-editor>-->

<h3>Bubble editor
  <button type="button" (click)="placeholder=placeholder + '!'">Change placeholder</button>
</h3>
<quill-editor theme="bubble" [placeholder]="placeholder"></quill-editor>

<h3>Editor without toolbar + required and ngModule</h3>
<button (click)="toggleReadOnly()">Toggle ReadOnly</button>
{{isReadOnly}}
{{title}}
<quill-editor [(ngModel)]="title" [maxLength]="5" [minLength]="3" [required]="true" [readOnly]="isReadOnly"
              [modules]="{toolbar: false}" (onContentChanged)="logChange($event);"
              (onSelectionChanged)="logSelection($event);"></quill-editor>
<!-- <h3>Custom Toolbar with toolbar title-attributes + Word counter</h3> -->
<!-- <quill-editor [modules]="{ counter: { container: '#counter', unit: 'word' } }"> -->
  <!--<div quill-editor-toolbar>-->
<!--<span class="ql-formats">-->
<!--<select class="ql-font">-->
<!--<option value="aref">Aref Ruqaa</option>-->
<!--<option value="mirza">Mirza</option>-->
<!--<option selected>Roboto</option>-->
<!--</select>-->
<!--<select class="ql-align" [title]="'Aligment'">-->
<!--<option selected></option>-->
<!--<option value="center"></option>-->
<!--<option value="right"></option>-->
<!--<option value="justify"></option>-->
<!--</select>-->
<!--<select class="ql-align" [title]="'Aligment2'">-->
<!--<option selected></option>-->
<!--<option value="center"></option>-->
<!--<option value="right"></option>-->
<!--<option value="justify"></option>-->
<!--</select>-->
<!--</span>-->
    <!--<span class="ql-formats">-->
<!--<div id="counter"></div>-->
<!--</span>-->
  <!--</div>-->
<!--</quill-editor>-->

counter.ts

import * as Quill from 'quill';

export interface Config {
  container: string;
  unit: 'word'|'char';
}

export interface QuillInstance {
  on: Function;
  getText: Function;
}

export default class Counter {
  quill: QuillInstance;
  options: Config;

  constructor(quill, options) {
    this.quill = quill;
    this.options = options;

    const container = document.querySelector(this.options.container);

    this.quill.on('text-change', () => {
      const length = this.calculate();

      container.innerHTML = length + ' ' + this.options.unit + 's';
    });
  }

  calculate() {
    const text = this.quill.getText().trim();

    if (this.options.unit === 'word') {
      return !text ? 0 : text.split(/\s+/).length;
    }
    return text.length;
  }
}

counter.d.ts although I just added this as a try everything situation, still dont have great understanding of d.ts

import * as Quill from 'quill';

export interface Config {
  container: string;
  unit: 'word'|'char';
}

export interface QuillInstance {
  on: Function;
  getText: Function;
}

export default class Counter {
  quill: QuillInstance;
  options: Config;

  constructor(quill, options) {
    this.quill = quill;
    this.options = options;

    const container = document.querySelector(this.options.container);

    this.quill.on('text-change', () => {
      const length = this.calculate();

      container.innerHTML = length + ' ' + this.options.unit + 's';
    });
  }

  calculate() {
    const text = this.quill.getText().trim();

    if (this.options.unit === 'word') {
      return !text ? 0 : text.split(/\s+/).length;
    }
    return text.length;
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.