Project

General

Profile

Paste an image from the clipboard !!

Added by wk lee over 4 years ago

Hi~

I studied how to paste an image from the clipboard into the redmine body.

It is possible in the following way.

-----------------------------------------------------------------------------------------------------------------
1. ckeditor plugin install

. plugin name : pastebase64
. install location : /var/www/redmine/plugins/redmine_ckeditor/assets/ckeditor/plugins/
. plugin download : https://ckeditor.com/cke4/addon/pastebase64

2. ckeditor config modify

. config file location : /var/www/redmine/plugins/redmine_ckeditor/assets/ckeditor

. Modify : config.js Add text --> config.extraPlugins = 'pastebase64,base64image';
--------------------------------------------------------------------------------------------------------

root@:/var/www/redmine/plugins/redmine_ckeditor/assets/ckeditor:> cat config.js

/** * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
// config.pasteFilter = null;

config.extraPlugins = 'pastebase64,base64image';

};
--------------------------------------------------------------------------------------------------------

3. ckeditor init.rb base64 allow Option Add

. file location : /var/www/redmine/plugins/redmine_ckeditor

. Modify : config.js --> last line add --> Loofah::HTML5::WhiteList::ALLOWED_PROTOCOLS.add('data')

. file text
--------------------------------------------------------------------------------------------------------
root@:/var/www/redmine/plugins/redmine_ckeditor:> cat init.rb

require 'redmine'
require 'redmine_ckeditor'

ActiveSupport::Reloader.to_prepare do
RedmineCkeditor.apply_patch
end

Redmine::Plugin.register :redmine_ckeditor do
name 'Redmine CKEditor plugin'
author 'Akihiro Ono'
description 'This is a CKEditor plugin for Redmine'
version '1.2.1'
requires_redmine :version_or_higher => '4.0.0'
url 'http://github.com/a-ono/redmine_ckeditor
settings(:partial => 'settings/ckeditor')
wiki_format_provider 'CKEditor', RedmineCkeditor::WikiFormatting::Formatter,
RedmineCkeditor::WikiFormatting::Helper
end

Loofah::HTML5::WhiteList::ALLOWED_PROTOCOLS.replace RedmineCkeditor.allowed_protocols

Loofah::HTML5::WhiteList::ALLOWED_PROTOCOLS.add('data')

4. Apache Restart