Skip to content

Commit

Permalink
LIB-662 use image placeholder for scifree search
Browse files Browse the repository at this point in the history
  • Loading branch information
bricas committed Sep 20, 2024
1 parent a8eb637 commit cfee58e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Binary file added custom/modules/guides/img/scifree-placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions custom/modules/guides/js/plugins/scifree/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

editor.widgets.add('scifree', {
button: 'SciFree',
template: '<div class="scifree">SciFree Search Widget</div>',
allowedContent: 'div(!scifree)',
requiredContent: 'div(scifree)',
template: '<div class="scifree"><img src="/modules/custom/guides/img/scifree-placeholder.png" /></div>',
allowedContent: 'div(!scifree); img[!src]',
requiredContent: 'div(scifree); img[src]',
upcast: function(element) {
return element.name == 'div' && element.hasClass('scifree');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function process($text, $langcode) {
'#theme' => 'ckeditor-scifree',
];
$widget = $this->renderer->render($render);
$text = str_replace('<div class="scifree">SciFree Search Widget</div>', $widget, $text);
$text = str_replace('<div class="scifree"><img src="/modules/custom/guides/img/scifree-placeholder.png" /></div>', $widget, $text);
$result->setProcessedText($text);
}
return $result;
Expand Down

0 comments on commit cfee58e

Please sign in to comment.