PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | assets/src/js/frontend/course-builder/builder-lesson/builder-edit-lesson.js +33 -9 4.3.7 → 4.4.10 View file →
@@ -284,8 +284,40 @@
284 284 `.cb-section__lesson-edit ${ BuilderEditLesson.selectors.elPermalinkRoot }`
285 285 );
286 286 }
287 287
288 + isDescriptionEditorInCodeMode() {
289 + const editorId = BuilderEditLesson.selectors.idDescEditor;
290 + const wrapper =
291 + document.getElementById( `wp-${ editorId }-wrap` ) ||
292 + document.getElementById( `${ editorId }-wrap` );
293 + if ( wrapper?.classList.contains( 'html-active' ) ) {
294 + return true;
295 + }
296 +
297 + const editor = typeof tinymce !== 'undefined' ? tinymce.get( editorId ) : null;
298 +
299 + return !! ( editor?.isHidden && editor.isHidden() );
300 + }
301 +
302 + getDescriptionContentForUpdate() {
303 + const editorId = BuilderEditLesson.selectors.idDescEditor;
304 + const descEditor = document.getElementById( editorId );
305 +
306 + if ( this.isDescriptionEditorInCodeMode() ) {
307 + return descEditor ? descEditor.value : '';
308 + }
309 +
310 + if ( typeof tinymce !== 'undefined' ) {
311 + const editor = tinymce.get( editorId );
312 + if ( editor ) {
313 + return editor.getContent();
314 + }
315 + }
316 +
317 + return descEditor ? descEditor.value : '';
318 + }
319 +
288 320 showPermalinkUnavailable( permalinkRoot, message = '' ) {
289 321 if ( ! permalinkRoot ) {
290 322 return;
291 323 }
@@ -331,17 +363,9 @@
331 363
332 364 const titleInput = document.getElementById( BuilderEditLesson.selectors.idTitle );
333 365 data.lesson_title = titleInput ? titleInput.value : '';
334 366
335 - const descEditor = document.getElementById( BuilderEditLesson.selectors.idDescEditor );
336 - data.lesson_description = descEditor ? descEditor.value : '';
337 -
338 - if ( typeof tinymce !== 'undefined' ) {
339 - const editor = tinymce.get( BuilderEditLesson.selectors.idDescEditor );
340 - if ( editor ) {
341 - data.lesson_description = editor.getContent();
342 - }
343 - }
367 + data.lesson_description = this.getDescriptionContentForUpdate();
344 368
345 369 const permalinkInput = document.querySelector(
346 370 `input[name="lesson_permalink"], #lesson_permalink, ${ BuilderEditLesson.selectors.elPermalinkSlugInput }`
347 371 );