danyaPostfactum/ckeditor-autocorrect-plugin

inclusive replacements, external expansion and a question

Opened this issue · 0 comments

  1. Great work! my users (2000+) are saving a ton of time using auto-expansion of abbreviations based on your plugin.

  2. A quick questions: why don't you use a Map() instead of object literal while defining replacements? (performance? portability?)

  3. An enhancement that I already applied in my version: to avoid conflicting (inclusive) replacement keys; e.g. where (AB) would actually might match another replacement key (AAB). why not prefix all keys with a safe prefix e.g. '_', this way AB would never match AAB.
    e.g.
    at line 508 of plugin.js
    if ( ('_' + sequence) in replacementTable)
    at line 510 of plugin.js
    replacement = replacementTable['_' + match];

  4. Another Enhancement: How about a hook in the form of call back from the host page to inject contextual content from such page into replacement text, something like, again from line 510 of plugin.js
    replacement = contextExpand(replacementTable['_' + match]);

Where contextExpand will be an overridable function to be replaced by the calling Page ?
this way replacement text can have placeholders e.g. [[CUSTOMER_NAME]] that only the calling page can replace based on whatever information is available to the end user at the time of execution

Again appreciate all your hard work, best of luck !
Cheers