commit 10af4f0c3e104dcc5cbf2eb82c8e7870c1995982
parent 8b5e4714b350c426f0f45994c05bcddbcaf8c35e
Author: sanjogs <sanjogsharma@gmail.com>
Date: Thu, 23 Jan 2025 12:15:09 -0500
iframe is considerd when checking for content
Diffstat:
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/striveneditor.js b/src/striveneditor.js
@@ -2143,8 +2143,7 @@ export default class StrivenEditor {
[...body.querySelectorAll('.se-link-options')].forEach(lOpt => lOpt.remove());
[...body.querySelectorAll('.se-image-options')].forEach(iOpt => iOpt.remove());
- if (body.textContent || se.body.getElementsByTagName('img').length) {
- // const htmlView = !!se.editor.querySelector('.se-html');
+ if (body.textContent || se.body.getElementsByTagName('img').length || se.body.getElementsByTagName('iframe').length) {
return body.innerHTML;
} else {
return null;
@@ -2521,8 +2520,8 @@ export default class StrivenEditor {
const imagesToEdit = se.body.querySelectorAll('.se-image-to-edit');
for (const img of imagesToEdit) {
img.classList.remove("se-image-to-edit");
- let wrapper= img.parentElement;
- if(wrapper.classList.contains('se-image-wrapper')){
+ let wrapper = img.parentElement;
+ if (wrapper.classList.contains('se-image-wrapper')) {
wrapper.parentElement.insertBefore(img, wrapper);
wrapper.remove();
}
@@ -3059,11 +3058,11 @@ export default class StrivenEditor {
if (!image.nextElementSibling || image.nextElementSibling.className !== "se-image-options") {
let imageWrapper = image.parentElement
- if(!imageWrapper.classList.contains('se-image-wrapper')){
+ if (!imageWrapper.classList.contains('se-image-wrapper')) {
imageWrapper = document.createElement('div');
imageWrapper.classList.add('se-image-wrapper');
imageWrapper.setAttribute('contenteditable', false);
- image.parentElement.insertBefore(imageWrapper,image);
+ image.parentElement.insertBefore(imageWrapper, image);
imageWrapper.appendChild(image);
}
const editImageMenu = document.createElement('span');
@@ -3141,19 +3140,21 @@ export default class StrivenEditor {
*/
createLinks(el) {
const se = this;
- linkify(el || se.body,
- {
- target: {
- url: '_blank'
- },
- className: 'linkified',
- validate: {
- email: function (value) {
- return false;
+ const htmlView = !!se.editor.querySelector('.se-html');
+ if (!htmlView) {
+ linkify(el || se.body,
+ {
+ target: {
+ url: '_blank'
+ },
+ className: 'linkified',
+ validate: {
+ email: function (value) {
+ return false;
+ }
}
- }
- }, document);
-
+ }, document);
+ }
var links = [];
if (el) {
const linkElements = el.getElementsByTagName('a');