angular-froala-wysiwyg icon indicating copy to clipboard operation
angular-froala-wysiwyg copied to clipboard

Two Froalas with same options not working

Open uwe-pichl opened this issue 5 years ago • 22 comments

When two Froalas are on the same page and using the same options, the second froala doesn't update it's "froalaModel"! If both froalas using different options, the binding works.

grafik

Example: https://stackblitz.com/edit/angular-froala-13aagf-tmlz3d

uwe-pichl avatar Jul 02 '19 11:07 uwe-pichl

Using "angular-froala-wysiwyg": "^3.0.1"

uwe-pichl avatar Jul 02 '19 11:07 uwe-pichl

I am experiencing the same issue and it is blocking us from upgrading to v3

See https://stackblitz.com/edit/angular-jafgm6?file=src%2Fapp%2Fapp.component.ts

When two editors in the same component are initialized with the same options object you can only retrieve the latest value from the first editor. If you retrieve the latest value from the 2nd editor, you only get the original value.

Tested with version 3.0.5

Any indication on when this will be fixed?

emeryowa avatar Sep 27 '19 08:09 emeryowa

Also having this issue.

Essentially we have multiple editors embedded in different form fields, most of which share the same options. It would be great to reuse these options objects instead of giving each form field it's own unique copy.

jjsiman avatar Oct 04 '19 16:10 jjsiman

We are also facing this issue after upgrading to v3. Any updates on when this fix could be coming? This seems like a major bug.

JCanlett avatar Oct 16 '19 13:10 JCanlett

@uwe-pichl This issue is scheduled for a fix in version 3.0.7. (will be released in the next 10 days) As a temporary solution, maybe you should consider something like this:

dejanmartinovic avatar Nov 04 '19 22:11 dejanmartinovic

You can workaround this issue if you deep clone the options every time you assign it. You can use lodash or use something like JSON.parse(JSON.stringify(options));

gigantedocil avatar Nov 19 '19 12:11 gigantedocil

@uwe-pichl This issue is scheduled for a fix in version 3.0.7. (will be released in the next 10 days) As a temporary solution, maybe you should consider something like this:

Any word on 3.07 release ?

JCanlett avatar Nov 19 '19 15:11 JCanlett

@uwe-pichl Update plz

JCanlett avatar Jan 21 '20 19:01 JCanlett

I have tested it on version 3.1 and still the same issue? Can you please provide an update on it?

JalpeshVadgama avatar Feb 18 '20 09:02 JalpeshVadgama

The workaround for this is like the following.

In the component HTML file put HTML like below

<textarea [froalaEditor]="GetOptions()" [(froalaModel)]="description1"></textarea>

<textarea [froalaEditor]="GetOptions()" [(froalaModel)]="description2"></textarea>

In the component typescript file create a function like below. public GetOptions(): any { return JSON.parse(JSON.stringify(this.options)); }

JalpeshVadgama avatar Feb 18 '20 09:02 JalpeshVadgama

Please fix it. It still exists in v3.1.0. It works fine without options but not whenever I put any options.

Pei116 avatar Mar 24 '20 12:03 Pei116

Any update on this?

elmartino avatar Apr 15 '20 20:04 elmartino

Does someone has a solution for this?? I am using angular-froala version 3.1.1 and facing this issue when i am creating multiple editors with same config on initialising the config is only getting applied to the first editor and not on any other editors i am getting following error " Converting circular structure to JSON --> starting at object with constructor 'E.Bootstrap' | property '$oel' -> object with constructor 'b' | property '0' -> object with constructor 'HTMLTextAreaElement' --- property 'data-froala.editor' closes the circle" It is causing me a lot of trouble. Can someone please help me with this?

shilpa-invy avatar Jun 24 '20 09:06 shilpa-invy

Like @gigantedocil said, use a different options object for each instance with for example const options1 = JSON.parse(JSON.stringify(options));

elmartino avatar Jun 24 '20 09:06 elmartino

@elmartino , The editor instances are generated dynamically using repeat in angular js and can vary in number depending on the list of content that i have.

shilpa-invy avatar Jun 24 '20 09:06 shilpa-invy

@elmartino , The editor instances are generated dynamically using repeat in angular js and can vary in number depending on the list of content that i have.

Then do something like [froalaEditor]="getFroalaOptions()"

getFroalaOptions() { return JSON.parse(JSON.stringify(this.froalaOptions)); }

elmartino avatar Jun 24 '20 09:06 elmartino

@elmartino , My current code looks something like this-- html

froala config $scope.froalaoption= { charCounterCount: false, quickInsertTags: [], toolbarInline: true, toolbarButtons: ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', '|', 'specialCharacters', 'color', 'emoticons', 'inlineStyle', 'paragraphStyle', '|', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', '-', 'quote', 'insertHR', 'insertLink', 'insertTable', '|', 'undo', 'redo', 'clearFormatting', 'selectAll', 'html', 'applyFormat', 'removeFormat', 'fullscreen', 'print', 'help'], [other config options...] };

So can you guide me what changes will i need to make in this?

shilpa-invy avatar Jun 24 '20 10:06 shilpa-invy

i'm sorry but first upgrade angular, then come back

elmartino avatar Jun 24 '20 10:06 elmartino

@elmartino ,I cannot do that. isn't there any workaround for this in my current angular version?

shilpa-invy avatar Jun 24 '20 10:06 shilpa-invy

I don't know. maybe someone else. You are using a version that is like 10 years old and 10 major versions behind :P

elmartino avatar Jun 24 '20 10:06 elmartino

We have fixed this issue in version angular-froala-wysiwyg 3.2.1-1. Regards

dejanmartinovic avatar Sep 04 '20 12:09 dejanmartinovic

Still not working

LLITRIXKOD avatar Dec 20 '22 13:12 LLITRIXKOD