@innovastudio/contentbuilder 1.0.81 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
- "version": "1.0.81",
3
+ "version": "1.0.82",
4
4
  "description": "",
5
5
  "main": "public/contentbuilder/contentbuilder.esm.js",
6
6
  "files": [
@@ -60311,7 +60311,35 @@ class ContentBuilder {
60311
60311
  sPastedText = util.cleanHTML(sPastedText, true);
60312
60312
  }
60313
60313
 
60314
- contentword.innerHTML = sPastedText; // NOTE: paste <h1><p> jadi nempel
60314
+ contentword.innerHTML = sPastedText;
60315
+
60316
+ if (this.opts.paste === 'html') {
60317
+ //with styles
60318
+ let elms = contentword.querySelectorAll('*');
60319
+ Array.prototype.forEach.call(elms, elm => {
60320
+ for (let n = 0; n < elm.attributes.length; n++) {
60321
+ if (elm.attributes[n].name !== 'style') elm.removeAttribute(elm.attributes[n].name);
60322
+ }
60323
+ }); // Extra:
60324
+ // Remove li with white-space: pre;
60325
+
60326
+ elms = contentword.querySelectorAll('li');
60327
+ Array.prototype.forEach.call(elms, elm => {
60328
+ elm.style.whiteSpace = '';
60329
+ });
60330
+ } else {
60331
+ //html-without-styles (default)
60332
+ const removeAttributes = element => {
60333
+ while (element.attributes.length > 0) {
60334
+ element.removeAttribute(element.attributes[0].name);
60335
+ }
60336
+ };
60337
+
60338
+ let elms = contentword.querySelectorAll('*');
60339
+ Array.prototype.forEach.call(elms, elm => {
60340
+ removeAttributes(elm);
60341
+ });
60342
+ } // NOTE: paste <h1><p> jadi nempel
60315
60343
  // NOTE ($editor => contentword)
60316
60344
  // if($editor.children('p,h1,h2,h3,h4,h5,h6,ul,li').length>1){
60317
60345
  // //Fix text that doesn't have paragraph
@@ -60371,6 +60399,7 @@ class ContentBuilder {
60371
60399
  // //jQuery("[class^='Mso']", $editor).removeAttr('class'); //done (see cleanHTML)
60372
60400
  // jQuery('p:empty', $editor).remove();
60373
60401
 
60402
+
60374
60403
  sPastedText = contentword.innerHTML;
60375
60404
  }
60376
60405
  }