Closed stevermeister closed 9 months ago
@bampakoa what do you think about this?
especially this part:
if (this._filterService){
this.pasteHtmlAtCaret(this._filterService.filter(text));
} else {
this.pasteHtmlAtCaret(text);
}
the idea is to use Filter as a Strategy pattern and keep the default one with the method filter
that will do nothing, but I did not manage to create it in such a way that it's possible to overwrite
@stevermeister how about having a separate dropdown option for pasting content as text (no styles), just like MS Word does?
@bampakoa I believe it's not only Word, it looks like it's already a standard.
still: 1) this feature is not only about styles, but any filtering/modification 2) for some old-school users it's still a challenge to do a paste and keep the right styles (we have a real use-case for our business application at Studytube)
Got it! LGTM!
actually I was asking more not about the feature itself, but more about architectural design.
I want to always apply the filter:
this.pasteHtmlAtCaret(this._filterService.filter(text));
(without any if's) and having default as an empty one
but provide a possibility to overwrite in applications that uses ngx-wig
Oh I see 🙂 Sorry for the confusion! Having the filter
method applying the default behavior without an indication seems a bit magic. I would change it as follows to be more explicit:
this.pasteHtmlAtCaret(this._filterService.filter({ value: text, mode: 'keepStyles' }));
ok, good, will keep it as it is :)
Issues
0 New issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
for instance to prevent the situation when extra styles were copy-pasted