|
@@ -409,6 +409,54 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
|
|
.attr('with-shortcuts', 1);
|
|
.attr('with-shortcuts', 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function initQuillRTE(_selector, _config = false, _shortcuts = false) {
|
|
|
|
+ if(!_config) _config = stagQuillConfig;
|
|
|
|
+ $(_selector).each(function() {
|
|
|
|
+
|
|
|
|
+ $(this).wrap(
|
|
|
|
+ $('<div class="border-left border-right rte-holder"/>')
|
|
|
|
+ .attr('data-shortcuts', '')
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // give a unique id to this editor instance
|
|
|
|
+ var editorID = Math.ceil(Math.random() * 99999),
|
|
|
|
+ fieldName = this.name;
|
|
|
|
+
|
|
|
|
+ var ti = $('<input type="hidden" />')
|
|
|
|
+ .val(this.value)
|
|
|
|
+ .attr('name', this.name)
|
|
|
|
+ .insertBefore(this);
|
|
|
|
+ var ce = $('<div data-editor-id="' + editorID + '" data-field="' + this.name + '"/>')
|
|
|
|
+ .html(this.value)
|
|
|
|
+ .insertBefore(this);
|
|
|
|
+ $(this).remove();
|
|
|
|
+
|
|
|
|
+ var qe = new Quill('[data-editor-id="' + editorID + '"]', {
|
|
|
|
+ theme: 'snow',
|
|
|
|
+ modules: _config ? _config : stagQuillConfig
|
|
|
|
+ });
|
|
|
|
+ var toolbar = $(qe.container).prev('.ql-toolbar');
|
|
|
|
+
|
|
|
|
+ // add button for new shortcut
|
|
|
|
+ if(_shortcuts) {
|
|
|
|
+ var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
|
|
|
|
+ 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
|
|
|
|
+ toolbar.append(newSCButton);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ qe.on('text-change', function() {
|
|
|
|
+ ti.val(qe.root.innerHTML);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $(qe.container)
|
|
|
|
+ .find('.ql-editor[contenteditable]')
|
|
|
|
+ .attr('data-field', fieldName)
|
|
|
|
+ .attr('data-editor-id', editorID)
|
|
|
|
+ .attr('with-shortcuts', 1);
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
var patientPresenceTimer = false;
|
|
var patientPresenceTimer = false;
|
|
function initFileInputs() {
|
|
function initFileInputs() {
|
|
$(document)
|
|
$(document)
|