vue2-bbl-editor 1.3.7 → 1.3.8
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/dist/vue2-bbl-editor.common.js +13 -16
- package/dist/vue2-bbl-editor.common.js.map +1 -1
- package/dist/vue2-bbl-editor.umd.js +13 -16
- package/dist/vue2-bbl-editor.umd.js.map +1 -1
- package/dist/vue2-bbl-editor.umd.min.js +13 -16
- package/dist/vue2-bbl-editor.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -15530,7 +15530,7 @@ function _arrayLikeToArray(r, a) {
|
|
|
15530
15530
|
/**
|
|
15531
15531
|
* CustomParagraph Extension
|
|
15532
15532
|
*
|
|
15533
|
-
* Extends the default paragraph to add custom attributes
|
|
15533
|
+
* Extends the default paragraph to add custom classes and attributes
|
|
15534
15534
|
* - Adds 'data-empty="true"' attribute to empty paragraphs in HTML output
|
|
15535
15535
|
* - Maintains all default paragraph functionality
|
|
15536
15536
|
* - Provides better styling control for empty content
|
|
@@ -15553,27 +15553,24 @@ function _arrayLikeToArray(r, a) {
|
|
|
15553
15553
|
renderHTML: function renderHTML(_ref) {
|
|
15554
15554
|
var node = _ref.node,
|
|
15555
15555
|
HTMLAttributes = _ref.HTMLAttributes;
|
|
15556
|
-
|
|
15557
|
-
var
|
|
15556
|
+
var hasContent = node.content.size > 0;
|
|
15557
|
+
var isEmpty = !hasContent || node.content.size === 0;
|
|
15558
15558
|
|
|
15559
|
-
// Check if paragraph
|
|
15560
|
-
var
|
|
15561
|
-
if (
|
|
15562
|
-
// Check each child node
|
|
15559
|
+
// Check if paragraph only contains empty text or whitespace
|
|
15560
|
+
var isReallyEmpty = true;
|
|
15561
|
+
if (hasContent) {
|
|
15563
15562
|
node.content.forEach(function (child) {
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
isEmpty = false;
|
|
15567
|
-
}
|
|
15568
|
-
// If it's any other type of node (image, etc.), it's not empty
|
|
15569
|
-
else if (child.type.name !== 'text') {
|
|
15570
|
-
isEmpty = false;
|
|
15563
|
+
if (child.type.name !== 'text' || child.text && child.text.trim() !== '') {
|
|
15564
|
+
isReallyEmpty = false;
|
|
15571
15565
|
}
|
|
15572
15566
|
});
|
|
15573
15567
|
}
|
|
15574
15568
|
|
|
15575
|
-
//
|
|
15576
|
-
|
|
15569
|
+
// Merge custom attributes with existing HTMLAttributes
|
|
15570
|
+
var attrs = Object(core_["mergeAttributes"])(this.options.HTMLAttributes, HTMLAttributes);
|
|
15571
|
+
|
|
15572
|
+
// Add data-empty attribute if paragraph is empty or only contains whitespace
|
|
15573
|
+
if (isEmpty || isReallyEmpty) {
|
|
15577
15574
|
attrs['data-empty'] = 'true';
|
|
15578
15575
|
}
|
|
15579
15576
|
return ['p', attrs, 0];
|