diff --git a/app/assets/javascripts/sitewide/tiny_mce.js b/app/assets/javascripts/sitewide/tiny_mce.js index 76f247ca4..ec89d6b3e 100644 --- a/app/assets/javascripts/sitewide/tiny_mce.js +++ b/app/assets/javascripts/sitewide/tiny_mce.js @@ -123,6 +123,7 @@ var TinyMCE = (function() { // returns a public API for TinyMCE editor return Object.freeze({ init: function(selector, onSaveCallback) { + var editorInstancePromise; var tinyMceContainer; var tinyMceInitSize; var plugins; @@ -142,7 +143,7 @@ var TinyMCE = (function() { document.location.hash = textAreaObject.data('objectType') + '_' + textAreaObject.data('objectId'); } - tinyMCE.init({ + editorInstancePromise = tinyMCE.init({ cache_suffix: '?v=4.9.10', // This suffix should be changed any time library is updated selector: selector, convert_urls: false, @@ -354,6 +355,8 @@ var TinyMCE = (function() { }); editor.on('blur', function(e) { + if (editor.blurDisabled) return false; + if ($('.atwho-view:visible').length || $('#MarvinJsModal:visible').length) return false; setTimeout(() => { if (editor.isNotDirty === false) { @@ -373,6 +376,8 @@ var TinyMCE = (function() { save_onsavecallback: function(editor) { saveAction(editor); } }); } + + return editorInstancePromise; }, destroyAll: function() { _.each(tinyMCE.editors, function(editor) { diff --git a/app/assets/stylesheets/protocols/tinymce_editor.scss b/app/assets/stylesheets/protocols/tinymce_editor.scss new file mode 100644 index 000000000..c91fc309b --- /dev/null +++ b/app/assets/stylesheets/protocols/tinymce_editor.scss @@ -0,0 +1,57 @@ +.protocol-content { + .tinymce-container { + align-items: center; + border-radius: 4px; + display: flex; + min-height: 36px; + width: 100%; + + form > .form-group { + margin-bottom: 0; + + > .mce-tinymce { + border: 1px solid $color-silver-chalice; + box-shadow: none; + } + } + + &.error { + .form-group > .mce-tinymce { + border-color: $brand-danger; + } + + .tinymce-save-button { + opacity: .5; + pointer-events: none; + } + } + + .mce-tinymce.mce-container.mce-panel { + border-radius: 4px; + } + + .mce-menubar.mce-toolbar.mce-first { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + } + + .mce-statusbar { + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + } + + .tinymce-status-badge { + display: none; + } + + .tinymce-view { + border-color: transparent; + } + } + + .tinymce-error { + color: $brand-danger; + font-size: 12px; + margin-top: 2px; + } +} diff --git a/app/assets/stylesheets/shared/inline_edit.scss b/app/assets/stylesheets/shared/inline_edit.scss index 09ff22fa0..958d585e4 100644 --- a/app/assets/stylesheets/shared/inline_edit.scss +++ b/app/assets/stylesheets/shared/inline_edit.scss @@ -8,6 +8,7 @@ .sci-inline-edit__content { border: $border-transparent; + border-radius: 4px; display: flex; flex-direction: column; justify-content: center; @@ -15,6 +16,7 @@ margin-left: -.25em; min-height: 36px; padding-left: .25em; + position: relative; width: 100%; .sci-inline-edit__view { @@ -40,22 +42,35 @@ &:focus { outline: none; } - - &.error { - border-color: $brand-danger; - } } .sci-inline-edit__error { + bottom: -16px; color: $brand-danger; - font-size: .8em; + font-size: 12px; + font-weight: normal; + line-height: 12px; + position: absolute; } } &.editing { .sci-inline-edit__content { + background-color: $color-white; border-color: $brand-focus; + + &.error { + border-color: $brand-danger; + margin-bottom: 16px; + } + } + + .sci-inline-edit__control { + &.btn-disabled { + background: $color-silver-chalice; + color: $color-concrete; + } } } } diff --git a/app/assets/stylesheets/steps/components/text.scss b/app/assets/stylesheets/steps/components/text.scss index f9908ec38..18032fb8a 100644 --- a/app/assets/stylesheets/steps/components/text.scss +++ b/app/assets/stylesheets/steps/components/text.scss @@ -31,21 +31,6 @@ position: absolute; } - .tinymce-container { - align-items: center; - display: flex; - min-height: 36px; - width: 100%; - - .tinymce-status-badge { - display: none; - } - - .tinymce-view { - border-color: transparent; - } - } - &:hover:not(.edit) { background: $color-concrete; diff --git a/app/assets/stylesheets/steps/step.scss b/app/assets/stylesheets/steps/step.scss index f6f742de0..fd1f42669 100644 --- a/app/assets/stylesheets/steps/step.scss +++ b/app/assets/stylesheets/steps/step.scss @@ -11,6 +11,7 @@ .step-header { align-items: center; display: flex; + margin-bottom: 1.2em; .step-collapse-link { display: inline-block; diff --git a/app/javascript/vue/protocol/container.vue b/app/javascript/vue/protocol/container.vue index 890a1b04d..ced78aa9e 100644 --- a/app/javascript/vue/protocol/container.vue +++ b/app/javascript/vue/protocol/container.vue @@ -58,6 +58,7 @@ :objectId="parseInt(protocol.id)" :fieldName="'protocol[description]'" :lastUpdated="protocol.attributes.updated_at" + :characterLimit="100000" @update="updateDescription" /> diff --git a/app/javascript/vue/protocol/step_elements/checklist.vue b/app/javascript/vue/protocol/step_elements/checklist.vue index 96c8a2990..58ea68ccb 100644 --- a/app/javascript/vue/protocol/step_elements/checklist.vue +++ b/app/javascript/vue/protocol/step_elements/checklist.vue @@ -9,7 +9,7 @@ v-if="element.attributes.orderable.urls.update_url" :value="element.attributes.orderable.name" :sa_value="element.attributes.orderable.sa_name" - :characterLimit="255" + :characterLimit="10000" :placeholder="''" :allowBlank="false" :autofocus="editingName" diff --git a/app/javascript/vue/protocol/step_elements/text.vue b/app/javascript/vue/protocol/step_elements/text.vue index a11dcac04..fd3485da5 100644 --- a/app/javascript/vue/protocol/step_elements/text.vue +++ b/app/javascript/vue/protocol/step_elements/text.vue @@ -21,6 +21,7 @@ :objectId="element.attributes.orderable.id" :fieldName="'step_text[text]'" :lastUpdated="element.attributes.orderable.updated_at" + :characterLimit="100000" @update="update" @editingDisabled="disableEditMode" @editingEnabled="enableEditMode" diff --git a/app/javascript/vue/shared/inline_edit.vue b/app/javascript/vue/shared/inline_edit.vue index d6364d131..b7faef4d3 100644 --- a/app/javascript/vue/shared/inline_edit.vue +++ b/app/javascript/vue/shared/inline_edit.vue @@ -5,7 +5,6 @@ ref="input" rows="1" v-if="editing" - :class="{ 'error': error }" :placeholder="placeholder" v-model="newValue" @input="handleInput" @@ -19,7 +18,7 @@