Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for scenarios where content is inside the table-overflow-protection #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions scripts/h5peditor-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,15 @@ ns.Html.prototype.appendTo = function ($wrapper) {
// Remove overflow protection on startup
let initialData = editor.getData();
if (initialData.includes('table-overflow-protection')) {
initialData = initialData.replace(/<div class=\"table-overflow-protection\">.*<\/div>/, '');
editor.setData(initialData);
const match = initialData.match(/<div class="table-overflow-protection">(.*?)<\/div>/);
if (match && match[0]) {
// Set the editor data to just the content of the table-overflow-protection div
editor.setData(match[0]);
} else {
// If no match is found, remove the external div
initialData = initialData.replace(/<div class="table-overflow-protection">.*?<\/div>/, '');
editor.setData(initialData);
}
}

// Mimic old enter_mode behaviour if not specifically set to 'p'
Expand Down