Skip to content

Commit 9c5bb0b

Browse files
committed
Type option to switch between ordered and unordered list for list component
1 parent ad97f1c commit 9c5bb0b

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

public/js/vvvebjs/components-html.js

+58-3
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,65 @@ Vvveb.Components.extend("_base", "html/list", {
900900
name: "List",
901901
image: "icons/list.svg",
902902
html: `<ul>
903-
<li>Today I shall be meeting with interference, ingratitude, insolence, disloyalty, ill-will, and selfishness all of them due to the offenders' ignorance of what is good or evil..</li>
904-
<li>Today I shall be meeting with interference, ingratitude, insolence, disloyalty, ill-will, and selfishness all of them due to the offenders' ignorance of what is good or evil..</li>
905-
<li>Today I shall be meeting with interference, ingratitude, insolence, disloyalty, ill-will, and selfishness all of them due to the offenders' ignorance of what is good or evil..</li>
903+
<li>Begin with the possible; begin with one step.</li>
904+
<li>Never think of results, just do!</li>
905+
<li>Patience is the mother of will.</li>
906+
<li>Man must use what he has, not hope for what is not.</li>
907+
<li>Only super-efforts count.</li>
906908
</ul>`,
909+
properties: [{
910+
name: "Type",
911+
key: "type",
912+
inputtype: SelectInput,
913+
914+
onChange: function(node, value) {
915+
return changeNodeName(node, value);
916+
},
917+
918+
init: function(node) {
919+
return node.nodeName.toLowerCase()
920+
},
921+
922+
data:{
923+
options: [{
924+
value: "ul",
925+
text: "Unordered"
926+
}, {
927+
value: "ol",
928+
text: "Ordered"
929+
}]
930+
},
931+
},{
932+
name: "Items",
933+
key: "items",
934+
inputtype: ListInput,
935+
htmlAttr:"data-slides-per-view",
936+
inline:true,
937+
data: {
938+
selector:"li",
939+
container:"",
940+
prefix:"Item ",
941+
removeElement: true,
942+
"newElement": `<li>Do everything quickly and well.</li>`
943+
},
944+
onChange: function(node, value, input, component, event) {
945+
let element = node;
946+
947+
if (event.action) {
948+
if (event.action == "add") {
949+
//node.append(generateElements(`<li>List item</li>`)[0]);
950+
951+
//temporary solution to better update list
952+
Vvveb.Components.render("html/list");
953+
}
954+
if (event.action == "remove") {
955+
} else if (event.action == "select") {
956+
}
957+
}
958+
959+
return node;
960+
},
961+
}]
907962
});
908963

909964
Vvveb.Components.extend("_base", "html/preformatted", {

0 commit comments

Comments
 (0)