Plugin Directory

Changeset 2769687


Ignore:
Timestamp:
08/12/2022 09:45:43 AM (4 years ago)
Author:
unfluff
Message:

Classic editor fixes

Location:
unfluff-io-content-optimization
Files:
17 added
3 edited

Legend:

Unmodified
Added
Removed
  • unfluff-io-content-optimization/trunk/assets/js/classic_editor.js

    r2769673 r2769687  
    120120      alert('Unfluff works with the visual editor only! Please switch to the visual editor and click the unfluff button again.');
    121121    } else { // We are in tinyMCE mode
    122         let activeEditor = tinymce.get('content');
    123         if(activeEditor){ // Make sure we're not calling setContent on null
    124           highlighted_content = activeEditor.getContent(); // get tinyMCE's content
     122        let post_editor = tinymce.get('content');
     123        if(post_editor){ // Make sure we're not calling setContent on null
     124          highlighted_content = post_editor.getContent(); // get tinyMCE's content
    125125          $('.fluff-sentence .fulff-sentence-text').each(function(i, obj) {
    126126            let fluff_sentence = $(this).text();
     
    137137            }
    138138          });
    139           tinymce.activeEditor.setContent(highlighted_content); // Update tinyMCE's content
    140           $(tinymce.activeEditor.getBody()).find('unfluffmark').get(0).scrollIntoView({behavior: "smooth", block: "center", inline: "center"}); // scroll to first highlighted sentence
     139          post_editor.setContent(highlighted_content); // Update tinyMCE's content
     140          $(post_editor.getBody()).find('unfluffmark').get(0).scrollIntoView({behavior: "smooth", block: "center", inline: "center"}); // scroll to first highlighted sentence
    141141        }
    142142    }   
     
    150150      alert('Unfluff works with visual editor only! Please switch to visual editor and click the unfluff button again.');
    151151    } else { // We are in tinyMCE mode
    152         let activeEditor = tinyMCE.get('content');
    153         if(activeEditor!==null){ // Make sure we're not calling setContent on null
    154             unhighlighted_content = tinymce.activeEditor.getContent(); // get tinyMCE's content
     152        let post_editor = tinyMCE.get('content');
     153        if(post_editor!==null){ // Make sure we're not calling setContent on null
     154            unhighlighted_content = post_editor.getContent(); // get tinyMCE's content
    155155            unhighlighted_content = unhighlighted_content.replaceAll( '<unfluffmark class="unfluff-highlight">', '' );
    156156            unhighlighted_content = unhighlighted_content.replaceAll( '</unfluffmark>', '' );
    157             tinymce.activeEditor.setContent(unhighlighted_content); // Update tinyMCE's content
     157            post_editor.setContent(unhighlighted_content); // Update tinyMCE's content
    158158        }
    159159    }   
     
    163163  function unfluff_single_highlight(sentence){
    164164    remove_highlights(); // remove previous highlights if any
    165     let activeEditor = tinyMCE.get('content');
    166     let editor_content = activeEditor.getContent();
     165    let post_editor = tinyMCE.get('content');
     166    let editor_content = post_editor.getContent();
    167167    let single_higlight = '';
    168168    if (editor_content.indexOf(sentence) >= 0) { // text exists without html tags
     
    175175      single_higlight = editor_content.replaceAll( sentence_with_html, '<unfluffmark class="unfluff-highlight">' + sentence_with_html + '</unfluffmark>');
    176176    }
    177     tinymce.activeEditor.setContent(single_higlight); // Update tinyMCE's content
    178     $(tinymce.activeEditor.getBody()).find('unfluffmark').get(0).scrollIntoView({behavior: "smooth", block: "center", inline: "center"});
     177    post_editor.setContent(single_higlight); // Update tinyMCE's content
     178    $(post_editor.getBody()).find('unfluffmark').get(0).scrollIntoView({behavior: "smooth", block: "center", inline: "center"});
    179179  }
    180180
     
    237237  // remove highlights in update hover
    238238  $('#publishing-action').on('mouseover', '#publish',function(){
    239     let activeEditor = tinyMCE.get('content').getContent();
     239    let post_editor = tinyMCE.get('content').getContent();
    240240    let highlight_mark = '<unfluffmark class="unfluff-highlight">'
    241     if(activeEditor.indexOf(highlight_mark) >= 0) { // text exis
     241    if(post_editor.indexOf(highlight_mark) >= 0) { // text exis
    242242      remove_highlights();
    243243      $('#unfluff-highlight-remove').addClass('unfluff-hide');
  • unfluff-io-content-optimization/trunk/readme.txt

    r2769673 r2769687  
    33Contributors: unfluff
    44Tags: content, optimization, readability
    5 Requires at least: 4.5
     5Requires at least: 5.0
    66Tested up to: 6.0.1
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939 
    4040== Changelog ==
     41= 1.0.1 =
     42* classic editor fix
    4143= 1.0.0 =
    4244* Plugin released.
  • unfluff-io-content-optimization/trunk/unfluff.php

    r2769200 r2769687  
    66Author: Unfluff.io
    77Author URI: https://unfluff.io/
    8 Version: 1.0.0
     8Version: 1.0.1
    99*/
    1010
Note: See TracChangeset for help on using the changeset viewer.