Skip to content

Commit

Permalink
Add ACF compat - support multiple TinyMCE editors
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafauysal committed Sep 20, 2024
1 parent 3b7eb1d commit a7271d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions assets/js/admin/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ wp.hooks.addFilter('editor.BlockEdit', 'easytts/toolbar-button', withToolbarButt
});


$('.easytts-classic-editor-btn').on('click', function (e) {
let tinyMceActive = isTinyMCEActive();
$(document).on('click', '.easytts-classic-editor-btn', function (e) {
const editorID = $(this).data('editor-id') || 'content';
let tinyMceActive = isTinyMCEActive(editorID);
let voiceContent = '';
if (tinyMceActive) {
voiceContent = getTinymceContent();
voiceContent = getTinymceContent(editorID);
} else {
const selectedText = getSelectedText($('#content'));
voiceContent = selectedText ? selectedText.trim() : $('#content').val();
const selectedText = getSelectedText($('#' + editorID));
voiceContent = selectedText ? selectedText.trim() : $('#' + editorID).val();
voiceContent = getTrimmedText(voiceContent);
}

const editorID = $(this).data('editor-id');
$('#easytts-editor-id').val(editorID);

$('#easytts-content').text(voiceContent);
Expand Down
2 changes: 1 addition & 1 deletion dist/js/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jquery', 'wp-element'), 'version' => '1e64b004503b66f3c05f');
<?php return array('dependencies' => array('jquery', 'wp-element'), 'version' => '5f46ee7d3300e71b3ad6');
Loading

0 comments on commit a7271d5

Please sign in to comment.