From d01787ad77dcf11824cc15db502fddf920cea734 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Thu, 3 Dec 2020 01:05:25 +0100 Subject: [PATCH] =?UTF-8?q?Modifica=20plugin=20CKEditor=20para=20resaltado?= =?UTF-8?q?=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se incluyen las referencias a las hojas de estilo y los archivos javascript necesarios para usar la librería highlight.js en el resaltado del código creado con el plugin codesnippet de CKEditor. --- plugins/redmine_ckeditor/lib/redmine_ckeditor.rb | 1 + .../lib/redmine_ckeditor/views_layouts_hook.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 plugins/redmine_ckeditor/lib/redmine_ckeditor/views_layouts_hook.rb diff --git a/plugins/redmine_ckeditor/lib/redmine_ckeditor.rb b/plugins/redmine_ckeditor/lib/redmine_ckeditor.rb index 54de23a..1ca6b8f 100644 --- a/plugins/redmine_ckeditor/lib/redmine_ckeditor.rb +++ b/plugins/redmine_ckeditor/lib/redmine_ckeditor.rb @@ -147,3 +147,4 @@ require 'redmine_ckeditor/messages_controller_patch' require 'redmine_ckeditor/mail_handler_patch' require 'redmine_ckeditor/pdf_patch' require 'redmine_ckeditor/tempfile_patch' +require 'redmine_ckeditor/views_layouts_hook' diff --git a/plugins/redmine_ckeditor/lib/redmine_ckeditor/views_layouts_hook.rb b/plugins/redmine_ckeditor/lib/redmine_ckeditor/views_layouts_hook.rb new file mode 100644 index 0000000..2cc9690 --- /dev/null +++ b/plugins/redmine_ckeditor/lib/redmine_ckeditor/views_layouts_hook.rb @@ -0,0 +1,11 @@ +module RedmineCkeditor + module Hooks + class ViewsLayoutsHook < Redmine::Hook::ViewListener + def view_layouts_base_html_head(context={}) + return stylesheet_link_tag('/plugin_assets/redmine_ckeditor/ckeditor-contrib/plugins/codesnippet/lib/highlight/styles/default.css', :media => 'all') + + javascript_include_tag('/plugin_assets/redmine_ckeditor/ckeditor-contrib/plugins/codesnippet/lib/highlight/highlight.pack.js') + + javascript_include_tag('inithighlight', :plugin => 'redmine_ckeditor') + end + end + end +end