|
@@ -257,6 +257,7 @@
|
|
|
$packed[] = $shortcut->shortcut . '|||' . $shortcut->text;
|
|
|
}
|
|
|
$packed = implode("^^^", $packed);
|
|
|
+ $shortcuts = $packed;
|
|
|
?>
|
|
|
{{--<div class="primary-form">
|
|
|
<div class="note-content {{ $note->is_cancelled ? 'cancelled' : '' }} {{ $note->is_signed_by_hcp ? 'readonly' : '' }}"
|
|
@@ -267,7 +268,7 @@
|
|
|
</div>--}}
|
|
|
@foreach($note->sections as $section)
|
|
|
<div class="p-3 border-bottom note-section">
|
|
|
- <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer" onclick="return $(this).parent().toggleClass('edit')">
|
|
|
+ <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer edit-trigger">
|
|
|
{{$section->sectionTemplate->title}}
|
|
|
<span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
|
|
|
</a>
|
|
@@ -395,4 +396,74 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <script>
|
|
|
+ (function() {
|
|
|
+ function init() {
|
|
|
+ $('textarea[rte]').each(function() {
|
|
|
+
|
|
|
+ $(this).wrap(
|
|
|
+ $('<div class="border-left border-right rte-holder"/>')
|
|
|
+ .attr('data-shortcuts', '{{ $packed }}')
|
|
|
+ );
|
|
|
+
|
|
|
+ // 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: {
|
|
|
+ keyboard: {
|
|
|
+ bindings: {
|
|
|
+ handleEnter: {
|
|
|
+ key: 13,
|
|
|
+ handler: function() {
|
|
|
+ if(!$('.stag-shortcuts:visible').length) return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ var toolbar = $(qe.container).prev('.ql-toolbar');
|
|
|
+
|
|
|
+ // add button for new shortcut
|
|
|
+ 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);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.edit-trigger')
|
|
|
+ .off('click.edit-trigger')
|
|
|
+ .on('click.edit-trigger', function() {
|
|
|
+ $(this).parent().toggleClass('edit');
|
|
|
+ if($(this).parent().is('.edit')) {
|
|
|
+ $(this).parent().find('[contenteditable]').first().focus();
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ addMCInitializer('note-single', init);
|
|
|
+ })();
|
|
|
+ </script>
|
|
|
@endsection
|