gd-sprest-bs 9.9.8 → 9.9.9
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.
|
@@ -33,10 +33,9 @@ var RichTextBox = function (props) {
|
|
|
33
33
|
options.modules = options.modules || {};
|
|
34
34
|
options.placeholder ? options.placeholder = props.placeholder : null;
|
|
35
35
|
options.readOnly == null && typeof (props.disabled) === "boolean" ? options.readOnly = props.disabled : null;
|
|
36
|
-
typeof (options.theme) === "undefined" ? options.theme = "snow" : null;
|
|
37
36
|
// See if are setting the default toolbar options
|
|
37
|
+
var showToolbar = true;
|
|
38
38
|
if (options.modules.toolbar == null) {
|
|
39
|
-
var showToolbar = true;
|
|
40
39
|
// Set the toolbar options
|
|
41
40
|
switch (props.toolbarType) {
|
|
42
41
|
// None
|
|
@@ -53,11 +52,11 @@ var RichTextBox = function (props) {
|
|
|
53
52
|
elToolbar.innerHTML = Toolbars.FullToolbar;
|
|
54
53
|
break;
|
|
55
54
|
}
|
|
56
|
-
// Set the
|
|
57
|
-
|
|
55
|
+
// Set the toolbar
|
|
56
|
+
options.modules.toolbar = elToolbar;
|
|
58
57
|
}
|
|
59
58
|
else {
|
|
60
|
-
// Set the container
|
|
59
|
+
// Set the toolbar container
|
|
61
60
|
options.modules.toolbar.container = elToolbar;
|
|
62
61
|
}
|
|
63
62
|
// Create the element
|
|
@@ -83,6 +82,11 @@ var RichTextBox = function (props) {
|
|
|
83
82
|
}
|
|
84
83
|
// Apply the plugin
|
|
85
84
|
var quillObj = new Quill(elEditor, options);
|
|
85
|
+
// See if we are hiding the toolbar
|
|
86
|
+
if (!showToolbar) {
|
|
87
|
+
// Remove the snow class
|
|
88
|
+
elToolbar.classList.remove("ql-snow");
|
|
89
|
+
}
|
|
86
90
|
// Create the object
|
|
87
91
|
var obj = {
|
|
88
92
|
el: elRichTextBox,
|
|
@@ -720,7 +720,7 @@ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof =
|
|
|
720
720
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
721
721
|
|
|
722
722
|
"use strict";
|
|
723
|
-
eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.RichTextBoxControlType = exports.RichTextBox = exports.RichTextBoxTypes = void 0;\n\nvar gd_bs_1 = __webpack_require__(/*! gd-bs */ \"./node_modules/.pnpm/gd-bs@5.7.7/node_modules/gd-bs/build/index.js\");\n\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/.pnpm/quill@1.3.7/node_modules/quill/dist/quill.js\");\n\nvar Toolbars = __webpack_require__(/*! ./toolbar */ \"./build/components/richTextBox/toolbar.js\");\n/**\r\n * Toolbar Types\r\n */\n\n\nvar RichTextBoxTypes;\n\n(function (RichTextBoxTypes) {\n RichTextBoxTypes[RichTextBoxTypes[\"None\"] = 0] = \"None\";\n RichTextBoxTypes[RichTextBoxTypes[\"Basic\"] = 1] = \"Basic\";\n RichTextBoxTypes[RichTextBoxTypes[\"Full\"] = 2] = \"Full\";\n})(RichTextBoxTypes = exports.RichTextBoxTypes || (exports.RichTextBoxTypes = {}));\n/**\r\n * Rich TextBox\r\n */\n\n\nvar RichTextBox = function RichTextBox(props) {\n // Create the editor element\n var elRichTextBox = document.createElement(\"div\");\n elRichTextBox.classList.add(\"rich-textbox\"); // Create the toolbar element\n\n var elToolbar = document.createElement(\"div\");\n elToolbar.classList.add(\"toolbar-container\");\n elRichTextBox.appendChild(elToolbar); // Create the editor element\n\n var elEditor = document.createElement(\"div\");\n elEditor.classList.add(\"editor-container\");\n elRichTextBox.appendChild(elEditor); // Get the options and default the values\n\n var options = props.options || {};\n options.modules = options.modules || {};\n options.placeholder ? options.placeholder = props.placeholder : null;\n options.readOnly == null && typeof props.disabled === \"boolean\" ? options.readOnly = props.disabled : null
|
|
723
|
+
eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.RichTextBoxControlType = exports.RichTextBox = exports.RichTextBoxTypes = void 0;\n\nvar gd_bs_1 = __webpack_require__(/*! gd-bs */ \"./node_modules/.pnpm/gd-bs@5.7.7/node_modules/gd-bs/build/index.js\");\n\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/.pnpm/quill@1.3.7/node_modules/quill/dist/quill.js\");\n\nvar Toolbars = __webpack_require__(/*! ./toolbar */ \"./build/components/richTextBox/toolbar.js\");\n/**\r\n * Toolbar Types\r\n */\n\n\nvar RichTextBoxTypes;\n\n(function (RichTextBoxTypes) {\n RichTextBoxTypes[RichTextBoxTypes[\"None\"] = 0] = \"None\";\n RichTextBoxTypes[RichTextBoxTypes[\"Basic\"] = 1] = \"Basic\";\n RichTextBoxTypes[RichTextBoxTypes[\"Full\"] = 2] = \"Full\";\n})(RichTextBoxTypes = exports.RichTextBoxTypes || (exports.RichTextBoxTypes = {}));\n/**\r\n * Rich TextBox\r\n */\n\n\nvar RichTextBox = function RichTextBox(props) {\n // Create the editor element\n var elRichTextBox = document.createElement(\"div\");\n elRichTextBox.classList.add(\"rich-textbox\"); // Create the toolbar element\n\n var elToolbar = document.createElement(\"div\");\n elToolbar.classList.add(\"toolbar-container\");\n elRichTextBox.appendChild(elToolbar); // Create the editor element\n\n var elEditor = document.createElement(\"div\");\n elEditor.classList.add(\"editor-container\");\n elRichTextBox.appendChild(elEditor); // Get the options and default the values\n\n var options = props.options || {};\n options.modules = options.modules || {};\n options.placeholder ? options.placeholder = props.placeholder : null;\n options.readOnly == null && typeof props.disabled === \"boolean\" ? options.readOnly = props.disabled : null; // See if are setting the default toolbar options\n\n var showToolbar = true;\n\n if (options.modules.toolbar == null) {\n // Set the toolbar options\n switch (props.toolbarType) {\n // None\n case RichTextBoxTypes.None:\n elToolbar.innerHTML = \"\";\n showToolbar = false;\n break;\n // Basic\n\n case RichTextBoxTypes.Basic:\n elToolbar.innerHTML = Toolbars.BasicToolbar;\n break;\n // Default - Full\n\n default:\n elToolbar.innerHTML = Toolbars.FullToolbar;\n break;\n } // Set the toolbar\n\n\n options.modules.toolbar = elToolbar;\n } else {\n // Set the toolbar container\n options.modules.toolbar.container = elToolbar;\n } // Create the element\n\n\n var el = document.createElement(\"div\");\n el.appendChild(elRichTextBox); // See if we are rendering it to an element\n\n if (props.el) {\n // Ensure the parent element exists\n if (props.el.parentElement && props.el.parentElement.classList) {\n // Set the bootstrap class\n props.el.parentElement.classList.contains(\"bs\") ? null : props.el.parentElement.classList.add(\"bs\");\n } // Append the elements\n\n\n while (el.children.length > 0) {\n props.el.appendChild(el.children[0]);\n } // Update the element\n\n\n el = props.el;\n } else {\n // Set the bootstrap class\n el.classList.add(\"bs\");\n } // Apply the plugin\n\n\n var quillObj = new Quill(elEditor, options); // See if we are hiding the toolbar\n\n if (!showToolbar) {\n // Remove the snow class\n elToolbar.classList.remove(\"ql-snow\");\n } // Create the object\n\n\n var obj = {\n el: elRichTextBox,\n elContents: quillObj.root,\n quillObj: quillObj,\n getHtml: function getHtml() {\n return quillObj.root.innerHTML;\n },\n getText: function getText() {\n return quillObj.getText();\n },\n setHtml: function setHtml(value) {\n quillObj.root.innerHTML = value || \"\";\n }\n }; // Set the value\n\n props.value ? obj.setHtml(props.value) : null; // Execute the assign to event\n\n props.assignTo ? props.assignTo(obj) : null; // Return the object\n\n return obj;\n};\n\nexports.RichTextBox = RichTextBox; // Customize the form control\n\nexports.RichTextBoxControlType = 102;\ngd_bs_1.Components.FormControlTypes[\"RichTextBox\"] = exports.RichTextBoxControlType;\ngd_bs_1.Components.CustomControls.registerType(exports.RichTextBoxControlType, function (props) {\n var rtb = null; // Set the created method\n\n var onRendered = props.onControlRendered;\n\n props.onControlRendered = function (ctrl) {\n // Render a date/time\n rtb = (0, exports.RichTextBox)({\n className: props.className,\n disabled: props.isDisabled || props.isReadonly,\n el: ctrl.el,\n options: props.options,\n rows: props.rows,\n toolbarType: props.toolbarType,\n placeholder: props.placeholder,\n value: props.value\n }); // See if the label exists\n\n var elLabel = ctrl[\"_elLabel\"];\n\n if (elLabel) {\n // Set the id and aria properties\n elLabel ? elLabel.id = (props.id || props.name) + \"_label\" : null; //rtb.el.querySelector(\"input\").setAttribute(\"aria-labelledby\", elLabel.id);\n } // Set the control\n\n\n ctrl.setControl(rtb); // Call the custom render event\n\n onRendered ? onRendered(ctrl) : null;\n }; // Register a people picker\n\n\n props.onGetValue = function (ctrl) {\n // Return the value\n return rtb ? rtb.getHtml() : ctrl.value;\n };\n});\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/richTextBox/index.js?");
|
|
724
724
|
|
|
725
725
|
/***/ }),
|
|
726
726
|
|