diff --git a/src/bootstrapdatepicker.js b/src/bootstrapdatepicker.js
index 1df1c969..0ea802a9 100644
--- a/src/bootstrapdatepicker.js
+++ b/src/bootstrapdatepicker.js
@@ -45,6 +45,12 @@ function init(Survey, $) {
category: "general",
default: "mm/dd/yyyy",
},
+ {
+ // Can take a string
+ name: "language",
+ category: "general",
+ default: "en",
+ },
{
// Can take a Date or a string
// https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#options
@@ -69,6 +75,21 @@ function init(Survey, $) {
category: "general",
default: 0,
},
+ {
+ name: "startView:number",
+ category: "general",
+ default: 0,
+ },
+ {
+ name: "minViewMode:number",
+ category: "general",
+ default: 0,
+ },
+ {
+ name: "maxViewMode:number",
+ category: "general",
+ default: 4,
+ },
{
name: "clearBtn:boolean",
category: "general",
@@ -103,8 +124,12 @@ function init(Survey, $) {
const options = {
enableOnReadonly: false,
format: question.dateFormat,
+ language: question.language,
todayHighlight: question.todayHighlight,
weekStart: question.weekStart,
+ startView: question.startView,
+ minViewMode: question.minViewMode,
+ maxViewMode: question.maxViewMode,
clearBtn: question.clearBtn,
autoclose: question.autoClose,
daysOfWeekDisabled: question.daysOfWeekDisabled,
diff --git a/src/ck-editor.js b/src/ck-editor.js
index ce3c15b6..1f92d902 100644
--- a/src/ck-editor.js
+++ b/src/ck-editor.js
@@ -15,18 +15,63 @@ function init(Survey) {
"",
activatedByChanged: function (activatedBy) {
Survey.JsonObject.metaData.addClass("editor", [], null, "empty");
- Survey.JsonObject.metaData.addProperty("editor", {
- name: "height",
- default: 300,
- category: "general",
- });
+ Survey.JsonObject.metaData.addProperties("editor",[
+ {
+ name: "height",
+ default: 300,
+ category: "general",
+ },
+ {
+ name: "language",
+ default: "en",
+ category: "general"
+ },
+ {
+ name: "defaultLanguage",
+ default: "en",
+ category: "general"
+ }
+ ]);
},
afterRender: function (question, el) {
var name = question.inputId;
CKEDITOR.editorConfig = function (config) {
- config.language = "es";
+ config.defaultLanguage = question.language;
+ config.language = question.language;
config.height = question.height;
config.toolbarCanCollapse = true;
+
+ // Define changes to default configuration here.
+ // For complete reference see:
+ // https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html
+
+ // The toolbar groups arrangement, optimized for two toolbar rows.
+ config.toolbarGroups = [
+ { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
+ // { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
+ // { name: 'links' },
+ // { name: 'insert' },
+ // { name: 'forms' },
+ { name: 'tools' },
+ // { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
+ // { name: 'others' },
+ '/',
+ { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
+ { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
+ { name: 'styles' },
+ { name: 'colors' }
+ // { name: 'about' }
+ ];
+
+ // Remove some buttons provided by the standard plugins, which are
+ // not needed in the Standard(s) toolbar.
+ config.removeButtons = 'Underline,Subscript,Superscript';
+
+ // Set the most common block elements.
+ config.format_tags = 'p;h1;h2;h3;pre';
+
+ // Simplify the dialog windows.
+ config.removeDialogTabs = 'image:advanced;link:advanced';
};
el.name = name;
diff --git a/src/icheck.js b/src/icheck.js
index c5c49b6b..ab7282f0 100644
--- a/src/icheck.js
+++ b/src/icheck.js
@@ -8,9 +8,9 @@ function escValue(val) {
function init(Survey, $) {
$ = $ || window.$;
var widget = {
- className: "iradio_square-blue",
- checkboxClass: "iradio_square-blue",
- radioClass: "iradio_square-blue",
+ className: "iradio_flat-green",
+ checkboxClass: "icheckbox_flat-green",
+ radioClass: "iradio_flat-green",
name: "icheck",
widgetIsLoaded: function () {
return typeof $ == "function" && !!$.fn.iCheck;
diff --git a/src/summernote.js b/src/summernote.js
new file mode 100644
index 00000000..da42be15
--- /dev/null
+++ b/src/summernote.js
@@ -0,0 +1,147 @@
+function init(Survey) {
+ const iconId = "icon-editor";
+ Survey.SvgRegistry && Survey.SvgRegistry.registerIconFromSvg(iconId, require('svg-inline-loader!./images/editor.svg'), "");
+ var widget = {
+ name: "summernote",
+ title: "Editor",
+ iconName: iconId,
+ widgetIsLoaded: function () {
+ return typeof $ == "function" && !!$.fn.summernote;
+ },
+ isFit: function (question) {
+ return question.getType() === "summernote";
+ },
+ htmlTemplate:
+ '',
+ activatedByChanged: function (activatedBy) {
+ Survey.JsonObject.metaData.addClass("summernote", [], null, "text");
+ Survey.JsonObject.metaData.addProperties("summernote",[
+ // {
+ // name: "height",
+ // default: 300,
+ // category: "general",
+ // },
+ {
+ name: "lang",
+ default: "en",
+ category: "general"
+ },
+ {
+ name: "placeholder",
+ default: "",
+ category: "general"
+ },
+ {
+ name: "toolbar",
+ default: [
+ ['style', ['bold', 'italic', 'underline', 'clear']],
+ ['para', ['ul', 'ol', 'paragraph']]
+ ],
+ category:"general"
+ },
+ {
+ name:"hint",
+ default: {},
+ category:"general"
+ },
+ {
+ name: "disableDragAndDrop:boolean",
+ default: true,
+ category:"general"
+ },
+ {
+ name: "shortcuts:boolean",
+ default: false,
+ category:"general"
+ },
+ {
+ name: "codeviewFilter:boolean",
+ default: true,
+ category:"general"
+ },
+ {
+ name: "codeviewIFrameFilter:boolean",
+ default: true,
+ category:"general"
+ }
+ ]);
+ },
+ afterRender: function (question, el) {
+ var $el = $(el).is('.widget-summernote')
+ ? $(el)
+ : $(el).find('.widget-summernote');
+ const options = {
+ lang: question.language,
+ placeholder: question.placeholder,
+ toolbar: [['style', ['bold', 'italic', 'underline', 'clear']],
+ ['para', ['ul', 'ol', 'paragraph']]]
+ };
+ const summernoteWidget = $el.summernote(options).on("summernote.change", function (we, contents, $editable) {
+ if (question.value != contents) {
+ question.value = contents;
+ }
+ });
+
+ question.valueChangedCallback = function () {
+ var oldValue = summernoteWidget.summernote('code');
+ if(oldValue != question.value)
+ summernoteWidget.summernote(
+ "code",
+ !!question.value ? question.value : ""
+ );
+ };
+ question.valueChangedCallback();
+ question.readOnlyChangedCallback = function () {
+ if (question.isReadOnly) {
+ summernoteWidget.summernote('disable');
+ } else {
+ summernoteWidget.summernote('enable');
+ }
+ };
+ question.readOnlyChangedCallback();
+
+ },
+ willUnmount: function (question, el) {
+ var $el = $(el).is(".widget-summernote")
+ ? $(el)
+ : $(el).find(".widget-summernote");
+ $el.summernote("destroy");
+ question.valueChangedCallback = null;
+ question.readOnlyChangedCallback = null;
+ },
+ pdfQuestionType: "text",
+ // pdfRender: function (survey, options) {
+ // if (options.question.getType() === "editor") {
+ // const loc = new Survey.LocalizableString(survey, true);
+ // loc.text = options.question.value || options.question.defaultValue;
+ // options.question["locHtml"] = loc;
+ // if (
+ // options.question.renderAs === "standard" ||
+ // options.question.renderAs === "image"
+ // ) {
+ // options.question["renderAs"] = options.question.renderAs;
+ // } else options.question["renderAs"] = "auto";
+ // const flatHtml = options.repository.create(
+ // survey,
+ // options.question,
+ // options.controller,
+ // "html"
+ // );
+ // return new Promise(function (resolve) {
+ // flatHtml.generateFlats(options.point).then(function (htmlBricks) {
+ // options.bricks = htmlBricks;
+ // resolve();
+ // });
+ // });
+ // }
+ // },
+ };
+
+ Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "customtype");
+}
+
+if (typeof Survey !== "undefined") {
+ init(Survey);
+}
+
+export default init;
diff --git a/src/surveyjs-widgets.js b/src/surveyjs-widgets.js
index 3caa7ffa..7bd6f9b6 100644
--- a/src/surveyjs-widgets.js
+++ b/src/surveyjs-widgets.js
@@ -13,3 +13,4 @@ export { default as bootstrapslider } from "./bootstrap-slider.js";
export { default as microphone } from "./microphone.js";
export { default as emotionsratings } from "./emotionsratings.js";
export { default as bootstrapdatepicker } from "./bootstrapdatepicker.js";
+export { default as summernote } from "./summernote.js";
diff --git a/webpack.config.js b/webpack.config.js
index 1240e8a3..6b1a1633 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -36,8 +36,9 @@ var widgets = [
"easy-autocomplete",
"pretty-checkbox",
"bootstrap-slider",
- "microphone",
- "emotionsratings"
+ // "microphone",
+ "emotionsratings",
+ "summernote"
];
var dependencies = {