Changeset 2769673
- Timestamp:
- 08/12/2022 08:55:07 AM (4 years ago)
- Location:
- unfluff-io-content-optimization
- Files:
-
- 4 edited
-
tags/1.0.0/assets/js/classic_editor.js (modified) (7 diffs)
-
tags/1.0.0/readme.txt (modified) (1 diff)
-
trunk/assets/js/classic_editor.js (modified) (7 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
unfluff-io-content-optimization/tags/1.0.0/assets/js/classic_editor.js
r2768986 r2769673 14 14 return; 15 15 } else { // We are in tinyMCE mode 16 let activeEditor = tinyMCE.get('content'); 17 if(activeEditor!==null){ // Make sure we're not calling setContent on null 18 editor_content = tinymce.activeEditor.getContent(); // get tinyMCE's content 19 } 20 } 21 // return if content is empty 22 if(editor_content == ''){ 16 editor_content = tinymce.get('content').getContent();; // get tinyMCE's content 17 } 18 // return if no content 19 if(!editor_content){ 20 console.log('no content'); 21 clearInterval(loading_effect); 23 22 return; 24 23 } … … 91 90 // get announcements 92 91 function announcement_call() { 93 94 92 var ann_settings = { 95 93 'url': 'https://unfluff.io/wp-json/unfluff/ann', … … 105 103 $('#unfluff-announcement').html(ann_html); 106 104 } 107 108 105 }); 109 110 106 } 111 107 … … 124 120 alert('Unfluff works with the visual editor only! Please switch to the visual editor and click the unfluff button again.'); 125 121 } else { // We are in tinyMCE mode 126 let activeEditor = tinymce. activeEditor.getContent()127 if(activeEditor !==null){ // Make sure we're not calling setContent on null128 highlighted_content = activeEditor ; // get tinyMCE's content122 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 129 125 $('.fluff-sentence .fulff-sentence-text').each(function(i, obj) { 130 126 let fluff_sentence = $(this).text(); … … 167 163 function unfluff_single_highlight(sentence){ 168 164 remove_highlights(); // remove previous highlights if any 169 let activeEditor = tinymce.activeEditor.getContent(); 165 let activeEditor = tinyMCE.get('content'); 166 let editor_content = activeEditor.getContent(); 170 167 let single_higlight = ''; 171 if ( activeEditor.indexOf(sentence) >= 0) { // text exists without html tags172 single_higlight = activeEditor.replaceAll( sentence, '<unfluffmark class="unfluff-highlight">' + sentence + '</unfluffmark>');168 if (editor_content.indexOf(sentence) >= 0) { // text exists without html tags 169 single_higlight = editor_content.replaceAll( sentence, '<unfluffmark class="unfluff-highlight">' + sentence + '</unfluffmark>'); 173 170 } else{ // text has html tags, or maybe does not exist!!! 174 171 // covvert Active editor string to html markup 175 let editor_html = ConvertStringToHTML( activeEditor);172 let editor_html = ConvertStringToHTML(editor_content); 176 173 let sentence_with_html = $(editor_html).find("p:contains('" + fluff_sentence + "'), div:contains('" + fluff_sentence + "'), span:contains('" + fluff_sentence + "')"); 177 174 sentence_with_html = sentence_with_html.html(); console.log(sentence_with_html); 178 single_higlight = activeEditor.replaceAll( sentence_with_html, '<unfluffmark class="unfluff-highlight">' + sentence_with_html + '</unfluffmark>');175 single_higlight = editor_content.replaceAll( sentence_with_html, '<unfluffmark class="unfluff-highlight">' + sentence_with_html + '</unfluffmark>'); 179 176 } 180 177 tinymce.activeEditor.setContent(single_higlight); // Update tinyMCE's content … … 234 231 $('#fluff-sentences').on('click', '.unfluff-single-highlight', function() { 235 232 let single_sentence = $(this).parent().find('.fulff-sentence-text').text(); 236 console.log(single_sentence);233 //console.log(single_sentence); 237 234 unfluff_single_highlight(single_sentence); 238 235 }); … … 240 237 // remove highlights in update hover 241 238 $('#publishing-action').on('mouseover', '#publish',function(){ 242 let activeEditor = tiny mce.activeEditor.getContent();239 let activeEditor = tinyMCE.get('content').getContent(); 243 240 let highlight_mark = '<unfluffmark class="unfluff-highlight">' 244 241 if(activeEditor.indexOf(highlight_mark) >= 0) { // text exis -
unfluff-io-content-optimization/tags/1.0.0/readme.txt
r2769200 r2769673 22 22 1. Upload the plugin folder to your /wp-content/plugins/ folder 23 23 2. Go to the **Plugins** page and activate the plugin 24 3. Go to the plugin setting page and add your license key24 3. Go to the plugin settings page and add your license key 25 25 26 26 == Frequently Asked Questions == -
unfluff-io-content-optimization/trunk/assets/js/classic_editor.js
r2768988 r2769673 14 14 return; 15 15 } else { // We are in tinyMCE mode 16 let activeEditor = tinyMCE.get('content'); 17 if(activeEditor!==null){ // Make sure we're not calling setContent on null 18 editor_content = tinymce.activeEditor.getContent(); // get tinyMCE's content 19 } 20 } 21 // return if content is empty 22 if(editor_content == ''){ 16 editor_content = tinymce.get('content').getContent();; // get tinyMCE's content 17 } 18 // return if no content 19 if(!editor_content){ 20 console.log('no content'); 21 clearInterval(loading_effect); 23 22 return; 24 23 } … … 91 90 // get announcements 92 91 function announcement_call() { 93 94 92 var ann_settings = { 95 93 'url': 'https://unfluff.io/wp-json/unfluff/ann', … … 105 103 $('#unfluff-announcement').html(ann_html); 106 104 } 107 108 105 }); 109 110 106 } 111 107 … … 124 120 alert('Unfluff works with the visual editor only! Please switch to the visual editor and click the unfluff button again.'); 125 121 } else { // We are in tinyMCE mode 126 let activeEditor = tinymce. activeEditor.getContent()127 if(activeEditor !==null){ // Make sure we're not calling setContent on null128 highlighted_content = activeEditor ; // get tinyMCE's content122 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 129 125 $('.fluff-sentence .fulff-sentence-text').each(function(i, obj) { 130 126 let fluff_sentence = $(this).text(); … … 167 163 function unfluff_single_highlight(sentence){ 168 164 remove_highlights(); // remove previous highlights if any 169 let activeEditor = tinymce.activeEditor.getContent(); 165 let activeEditor = tinyMCE.get('content'); 166 let editor_content = activeEditor.getContent(); 170 167 let single_higlight = ''; 171 if ( activeEditor.indexOf(sentence) >= 0) { // text exists without html tags172 single_higlight = activeEditor.replaceAll( sentence, '<unfluffmark class="unfluff-highlight">' + sentence + '</unfluffmark>');168 if (editor_content.indexOf(sentence) >= 0) { // text exists without html tags 169 single_higlight = editor_content.replaceAll( sentence, '<unfluffmark class="unfluff-highlight">' + sentence + '</unfluffmark>'); 173 170 } else{ // text has html tags, or maybe does not exist!!! 174 171 // covvert Active editor string to html markup 175 let editor_html = ConvertStringToHTML( activeEditor);172 let editor_html = ConvertStringToHTML(editor_content); 176 173 let sentence_with_html = $(editor_html).find("p:contains('" + fluff_sentence + "'), div:contains('" + fluff_sentence + "'), span:contains('" + fluff_sentence + "')"); 177 174 sentence_with_html = sentence_with_html.html(); console.log(sentence_with_html); 178 single_higlight = activeEditor.replaceAll( sentence_with_html, '<unfluffmark class="unfluff-highlight">' + sentence_with_html + '</unfluffmark>');175 single_higlight = editor_content.replaceAll( sentence_with_html, '<unfluffmark class="unfluff-highlight">' + sentence_with_html + '</unfluffmark>'); 179 176 } 180 177 tinymce.activeEditor.setContent(single_higlight); // Update tinyMCE's content … … 234 231 $('#fluff-sentences').on('click', '.unfluff-single-highlight', function() { 235 232 let single_sentence = $(this).parent().find('.fulff-sentence-text').text(); 236 console.log(single_sentence);233 //console.log(single_sentence); 237 234 unfluff_single_highlight(single_sentence); 238 235 }); … … 240 237 // remove highlights in update hover 241 238 $('#publishing-action').on('mouseover', '#publish',function(){ 242 let activeEditor = tiny mce.activeEditor.getContent();239 let activeEditor = tinyMCE.get('content').getContent(); 243 240 let highlight_mark = '<unfluffmark class="unfluff-highlight">' 244 241 if(activeEditor.indexOf(highlight_mark) >= 0) { // text exis -
unfluff-io-content-optimization/trunk/readme.txt
r2769200 r2769673 22 22 1. Upload the plugin folder to your /wp-content/plugins/ folder 23 23 2. Go to the **Plugins** page and activate the plugin 24 3. Go to the plugin setting page and add your license key24 3. Go to the plugin settings page and add your license key 25 25 26 26 == Frequently Asked Questions ==
Note: See TracChangeset
for help on using the changeset viewer.