Skip to content

Commit

Permalink
EMMR-111 Restore legacy/reusable marginalia listing
Browse files Browse the repository at this point in the history
  • Loading branch information
camilocodes committed Nov 23, 2023
1 parent 9639fc1 commit c78edb6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ transcribe:
js:
js/build/transInsert.js: { preprocess: false, minified: false }
js/build/transReplace.js: { preprocess: false, minified: false }
js/emmr_ckeditor_marginalia.js: { }
dependencies:
- core/ckeditor5

Expand Down
27 changes: 27 additions & 0 deletions custom/modules/emmr_transcribe/js/emmr_ckeditor_marginalia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// On document ready.
jQuery(document).ready(function() {
if (jQuery("#recipe-details-header").length != 0) {
// Recipe node view functionality
// Copy annotations from CKEditor to annotations panel
origin = ".field--name-field-recipe-transcription .trxn-margin";
destin = "#recipe-anno";

// If marginalia found
var margins = jQuery(origin).clone();
jQuery("<br><br>").appendTo(margins);
if ( jQuery(origin).length != 0 ) {
// If annotations panel not found
if ( jQuery(destin).length === 0 ) {
var anno = "<div class='col-md-2' id='recipe-anno'></div>";
var parent = "#pages-trans-anno";
jQuery(anno).appendTo(parent);
}

// Append marginalia tittle and items
jQuery("<br><p><b>Marginalia</b></p>").appendTo(destin);
jQuery("<div id='marginalia'></div>").appendTo(destin);
destin += " > div#marginalia";
jQuery(margins).clone().appendTo(destin);
}
}
});

0 comments on commit c78edb6

Please sign in to comment.