SkyLundy / Fluency-Translation

A DeepL translation integration for the ProcessWire CMF/CMS platform
GNU General Public License v3.0
11 stars 1 forks source link

Not working for plain textarea fields in repeaters. #2

Closed duerrsimon closed 3 years ago

duerrsimon commented 3 years ago

I get the following error on a plain text field inside a repeater:

Uncaught ReferenceError: CKEDITOR is not defined
    at HTMLAnchorElement.<anonymous> (fluency.js:257)

You should probably be doing something like this:

      try {
        if (CKEDITOR != undefined && CKEDITOR.instances[targetInput.id]){
          // Get the source field ID from the target field ID by removing
          // the target input ID from the end
          sourceCkeditor = CKEDITOR.instances[targetInput.id.split('__')[0]]
          targetCkeditor = CKEDITOR.instances[targetInput.id]
          contentToTranslate = sourceCkeditor.document.getBody().getHtml()
        }
      } catch (e){
        console.log('no CK editor')
      } 
      if (contentToTranslate=== null){
        contentToTranslate = sourceInput.value
      }
SkyLundy commented 3 years ago

@duerrsimon Thanks for catching this, missed it after refactoring. I'll patch and push an update tonight.

SkyLundy commented 3 years ago

Just pushed the updated version 0.2.5 with this fix.

This list of commits is a mess because I pushed/tagged incorrectly last night while tired. Still tired, but at least it's fixed...

ivangretsky commented 2 years ago

Hey, @SkyLundy!

I am having same bug with Repeater Matrix fields in 0.3.2. Could you please reopen this. Or should I create a new issue?