Skip to content

Commit 094ff12

Browse files
Fix: Strip formatting when pasting into builder title fields (#3093)
* Show Mark Complete button when quiz requirements are met Fixes #3058 When a lesson has an attached quiz, students who mark the lesson as incomplete can now re-mark it as complete without retaking the quiz, provided they have already met the quiz requirements. Changes: - Modified llms_show_mark_complete_button() to check quiz completion status - Added 4 new unit tests for quiz completion scenarios * Fix: Strip formatting when pasting into builder title fields Adds a paste event handler for contenteditable elements that do not have the data-formatting attribute. This ensures that lesson, quiz, and section titles receive plain text when users paste formatted content from external sources. Fixes #3057 * Remove mark complete changes (belong to different PR #3092) * Add changelog entry for PR #3093 Fixes #3057
1 parent bde41cf commit 094ff12

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changelogs/3093.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
significance: patch
2+
type: fixed
3+
links:
4+
- "#3057"
5+
attributions:
6+
- "@faisalahammad"
7+
entry: Strip formatting when pasting into Course Builder title fields.

assets/js/builder/Views/_Editable.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* @since 3.16.0
1010
* @since 3.25.4 Unknown
1111
* @since 3.37.11 Replace reference to `wp.editor` with `_.getEditor()` helper.
12-
* @version 3.37.11
12+
* @since [version] Add paste event handler for plain contenteditable elements to strip formatting. Fixes #3057.
13+
* @version [version]
1314
*/
1415
define( [], function() {
1516

@@ -36,6 +37,7 @@ define( [], function() {
3637
'keydown .llms-input': 'on_keydown',
3738
'input .llms-input[type="number"]': 'on_blur',
3839
'paste .llms-input[data-formatting]': 'on_paste',
40+
'paste .llms-input[contenteditable]:not([data-formatting])': 'on_paste',
3941
},
4042

4143
/**

0 commit comments

Comments
 (0)