From ca4bca869dadf69db5427a8f03e60afb4898b154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Tiago?= Date: Sat, 8 Dec 2018 12:46:57 +0000 Subject: [PATCH] Default toolbar-options Sample usage --- rich-text-editor/rich-text-editor-viewModel.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/rich-text-editor/rich-text-editor-viewModel.js b/rich-text-editor/rich-text-editor-viewModel.js index 60c3e2a..5b82316 100644 --- a/rich-text-editor/rich-text-editor-viewModel.js +++ b/rich-text-editor/rich-text-editor-viewModel.js @@ -76,9 +76,15 @@ define( self.cleanDisplay = "none"; self.cleanBlockDisplay = "none"; - context.props.then(function (propertyMap) { - if(propertyMap.toolbarOptions) { - propertyMap.toolbarOptions.forEach(function(item) { + context.props.then(function (propertyMap) { + let toolBbarOptions; + if(!propertyMap.toolbarOptions == undefined) { + toolBbarOptions = propertyMap.toolbarOptions; + } else { + toolBbarOptions = ["text-sizes","bold","color","order","bullet","italic", "image"]; + } + + toolBbarOptions.forEach(function(item) { switch(item) { case "text-sizes": self.sizeDisplay = "inline"; @@ -175,8 +181,7 @@ define( default: text = "Nothing matched"; } - }); - } + }) }); }; @@ -187,4 +192,4 @@ define( }; return RichTextEditor; -}); \ No newline at end of file +});