From ad380b1968c7f93dd482c824071cdc15869abe52 Mon Sep 17 00:00:00 2001 From: Tan Yuanhong Date: Sat, 14 Mar 2020 15:31:20 +0800 Subject: [PATCH 1/3] Update documentation on icon slot for boxes --- docs/userGuide/components/advanced.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/userGuide/components/advanced.md b/docs/userGuide/components/advanced.md index 7843509881..9d71fcf6c9 100644 --- a/docs/userGuide/components/advanced.md +++ b/docs/userGuide/components/advanced.md @@ -71,6 +71,11 @@ Using the normal syntax, you are only able to use markdown formatting on heading
+**Box Slot Options:** +Slot name | Default class | Notes +--- | --- | --- +_icon | (depends on box's `type` attribute) | Example: `` will replace the icon with a cross sign in spite of the box's type. + **Panel Slot Options:** Slot name | Default class | Notes --- | --- | --- From 13eefec028dba02b71ddff1092f4fda9cd57a5d9 Mon Sep 17 00:00:00 2001 From: Tan Yuanhong Date: Thu, 19 Mar 2020 16:00:48 +0800 Subject: [PATCH 2/3] Update the examples for using icon slot for boxes. --- docs/userGuide/components/advanced.md | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/userGuide/components/advanced.md b/docs/userGuide/components/advanced.md index 9d71fcf6c9..2d886ebfbf 100644 --- a/docs/userGuide/components/advanced.md +++ b/docs/userGuide/components/advanced.md @@ -72,9 +72,31 @@ Using the normal syntax, you are only able to use markdown formatting on heading
**Box Slot Options:** -Slot name | Default class | Notes ---- | --- | --- -_icon | (depends on box's `type` attribute) | Example: `` will replace the icon with a cross sign in spite of the box's type. + +Slot name | Default class | +--- | --- | +icon | (depends on box's `type` attribute) | + +*Example 1*: Override the default icon for a certain type of box. + +```html + + :fas-home: + info + +``` + + + :fas-home: + info + + +*Example 2*: Use pictures (or even gifs) as icon for a box. + + + + some very useful info + **Panel Slot Options:** Slot name | Default class | Notes From 574ff07174cef57ab44b6a21c0a9ec79322d0506 Mon Sep 17 00:00:00 2001 From: Tan Yuanhong Date: Sat, 21 Mar 2020 10:38:03 +0800 Subject: [PATCH 3/3] Resolve comments. --- docs/userGuide/components/advanced.md | 30 ++++++++++++++++--- .../markbind/src/parsers/componentParser.js | 2 +- test/unit/utils/componentParserData.js | 6 ++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docs/userGuide/components/advanced.md b/docs/userGuide/components/advanced.md index 2d886ebfbf..8e9a248577 100644 --- a/docs/userGuide/components/advanced.md +++ b/docs/userGuide/components/advanced.md @@ -75,9 +75,9 @@ Using the normal syntax, you are only able to use markdown formatting on heading Slot name | Default class | --- | --- | -icon | (depends on box's `type` attribute) | +icon | depends on box's `type` attribute | -*Example 1*: Override the default icon for a certain type of box. +{{ icon_example }} Override the default icon for a certain type of box. ```html @@ -91,12 +91,34 @@ icon | (depends on box's `type` attribute) | info -*Example 2*: Use pictures (or even gifs) as icon for a box. +{{ icon_example }} Use pictures (or even gifs) as the icon for a box. - +```html + some very useful info +``` + + + + some very useful info + + +{{ icon_example }} Use [thumbnail]({{ baseUrl }}/userGuide/usingComponents.html#thumbnails) as the icon. + + +```html + + + use thumbnail as the icon + +``` + + + + use thumbnail as the icon + **Panel Slot Options:** Slot name | Default class | Notes diff --git a/src/lib/markbind/src/parsers/componentParser.js b/src/lib/markbind/src/parsers/componentParser.js index c9ed5eead3..06331480ac 100644 --- a/src/lib/markbind/src/parsers/componentParser.js +++ b/src/lib/markbind/src/parsers/componentParser.js @@ -356,7 +356,7 @@ function _parseBoxAttributes(node) { _warnConflictingAttributes(node, 'no-icon', ['icon']); _warnDeprecatedAttributes(node, { heading: 'header' }); - _parseAttributeWithoutOverride(node, 'icon', true, '_icon'); + _parseAttributeWithoutOverride(node, 'icon', true, 'icon'); _parseAttributeWithoutOverride(node, 'header', false, '_header'); _parseAttributeWithoutOverride(node, 'heading', false, '_header'); diff --git a/test/unit/utils/componentParserData.js b/test/unit/utils/componentParserData.js index 966e55f415..96dd33bcaf 100644 --- a/test/unit/utils/componentParserData.js +++ b/test/unit/utils/componentParserData.js @@ -241,13 +241,13 @@ module.exports.PARSE_TAB_GROUP_HEADER_EXPECTED = ` module.exports.PARSE_BOX_ICON = ` - Icon attribute should be inserted as internal _icon slot and deleted. + Icon attribute should be inserted as internal icon slot and deleted. `; module.exports.PARSE_BOX_ICON_EXPECTED = ` - - Icon attribute should be inserted as internal _icon slot and deleted. + + Icon attribute should be inserted as internal icon slot and deleted. `;