Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

How to integrate into a angular 4 project #47

Open
sushmithakumar opened this issue Mar 13, 2018 · 18 comments
Open

How to integrate into a angular 4 project #47

sushmithakumar opened this issue Mar 13, 2018 · 18 comments

Comments

@sushmithakumar
Copy link

I have followed the steps but the example sample ones weren't sufficient to understand the integration to angular 4 project .Please help with this solution

@ShiruJan
Copy link

I can help you, I have integrated the project with Angular 5, what is the doubt you have?

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 21, 2018 via email

@ShiruJan
Copy link

ShiruJan commented Mar 21, 2018

OK, I'll explain my case:
I install:
npm ngx-quill-editor --save

in app.module.ts:

import { QuillEditorModule } from 'ngx-quill-editor';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    QuillEditorModule,
  ], ...

Then, on the project:,

TS page:
public my_string: string;

HTML page:
<quill-editor name="detailEditTxt" [(ngModel)]="my_string"></quill-editor>
This will place all the text, images and links to videos that you write in the variable "my_string".
To see the result, just place a button that will run console.log (this.my_string).

Try it and tell me. In case of any error, please share it here.

Regards!

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 22, 2018 via email

@ShiruJan
Copy link

ShiruJan commented Mar 22, 2018

Hi!
The variable "my_string" is the data model, this can be a simple string variable or an attribute of a data model. in this example, i use the variable "v_text":

captura de pantalla 2018-03-22 a la s 16 31 18

captura de pantalla 2018-03-22 a la s 16 23 29

Within the attribute or variable, all the content that is being introduced in the quill control will be stored, text with format, images (these are automatically converted to base64), links to videos, etc. Everything is stored in HTML format.

captura de pantalla 2018-03-22 a la s 16 28 02

Into DataBase
This would show the content inside the variable "v_text":

captura de pantalla 2018-03-22 a la s 16 25 58

All that html text, you store it in database, you send it by mail, etc.

If you want to add a style sheet, what you comment is correct, your snow.css style sheet can be placed in the angular-cli.json file, in the "styles" section, example:

"styles": [
         "styles.css",
         "assets / styles / sidenav.css",
]

I hope I have helped you, if you have more questions, please write them here, to help you.

regards!

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 23, 2018 via email

@ShiruJan
Copy link

ShiruJan commented Mar 25, 2018

haa ok!,
In this web it will help you to personalize the editor:
https://quilljs.com/docs/modules/toolbar/

ngx-quill-editor is developed based on quilljs.

Regards!

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 26, 2018 via email

@ShiruJan
Copy link

ShiruJan commented Mar 26, 2018

Do not worry, you can use it in the same way, I'll show you an example:

HTML CODE

<quill-editor id="detailEditTxt" name="detailEditTxt" [(ngModel)]="var_detailString"
                    [options]="editorOptions">
                </quill-editor>

TYPE SCRIPT CODE

// Configurations
    // Specific options for toolbox
    public toolbarOptions = [['bold', 'italic'], ['link', 'image']];

    // Set options
    public editorOptions = {
        placeholder: 'Write your text here ...'
        , modules: {
            toolbar: this.toolbarOptions
          }
    };

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 28, 2018 via email

@ShiruJan
Copy link

What is the error?

@sushmithakumar
Copy link
Author

2018-03-28-18-42-38
This is the error when used ng serve

@sushmithakumar
Copy link
Author

sushmithakumar commented Mar 29, 2018 via email

@ShiruJan
Copy link

ShiruJan commented Apr 2, 2018

Please, attach too your code please.

@sushmithakumar
Copy link
Author

npm ngx-quill-editor --save
So 2.2.4 version got installed .
In app.module.ts file
import { QuillEditorModule } from 'ngx-quill-editor';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
QuillEditorModule,
], ...
TS page:
public my_string: string;

HTML page:
<quill-editor name="detailEditTxt" [(ngModel)]="my_string">

Till here it was fine
It appeared with all the tools in it.
After that to customize where I needed only bold italic underline image and link
For that I used
Configurations
// Specific options for toolbox
public toolbarOptions = [['bold', 'italic'], ['link', 'image']];

// Set options
public editorOptions = {
    placeholder: 'Write your text here ...'
    , modules: {
        toolbar: this.toolbarOptions
      }
};

Initially it was working though it had one error..
For the semi-colon in the above piece of code.
Then after doing some alterations with the comma and semicolon.It gave me this error when I tried to clean build the file ng build as initially with editor options I was getting one error but rendered on chrome later when used ng build and ng serve got webpack compile failed and the lines of error above attached.

@sushmithakumar
Copy link
Author

After adding it started giving error as ngx quill editor not found..Then I changed this line
import { QuillEditorModule } from 'ngx-quill-editor'; to import { QuillEditorModule } from './node_modules/ngx-quill-editor';

I'm using angular cli

@sushmithakumar
Copy link
Author

1.5.0 and angular/compiler-cli version 5.0.0

@ShiruJan
Copy link

ShiruJan commented Apr 2, 2018

mmm ok,
update the version to "ngx-quill-editor": "2.2.2" and you start again from the beginng.

When it works again, add the controls configuration.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants