summernote-rails
summernote-rails copied to clipboard
Add imageSize75
Is it possible to add option imageSize75?
I try to use this summernote-image-attributes.js but it does not work
I also would like to know hos to add the imageSize75.
I already did the following: $(document).ready(function() { $('#summernote').summernote({ popover: { image: [ ['custom', ['imageAttributes']], ['imagesize', ['imageSize100', 'imageSize75', 'imageSize50', 'imageSize25']], ['float', ['floatLeft', 'floatRight', 'floatNone']], ['remove', ['removeMedia']] ], }, lang: 'en-US', // Change to your chosen language imageAttributes:{ icon:'', removeEmpty:false, // true = remove attributes | false = leave empty if present disableUpload: false // true = don't display Upload Options | Display Upload Options } });
});
And in summernote.js I added this popover: { image: [ ['imagesize', ['imageSize100', 'imageSize75','imageSize50', 'imageSize25']], ['float', ['floatLeft', 'floatRight', 'floatNone']], ['remove', ['removeMedia']] ],
And this in the Buttons.prototype.addImagePopoverButtons = function () { var _this = this; section
this.context.memo('button.imageSize75', function () {
return _this.button({
contents: '<span class="note-fontsize-10">75%</span>',
tooltip: _this.lang.image.resizeHalf,
click: _this.context.createInvokeHandler('editor.resize', '0.75')
}).render();
});
But when clicking on the image in the editor only 100%, 50% and 25% appears.
What more needs to be done?
It seems we need someone from the team for this? I have tried a lot of stuff to make it work, but still no luck
Hi John,
did you find solution for this ?
Hi Sandeep!
Sorry but no luck for this
Hey, guys! Have solution.
var ImageResize75PercentButton = function(context) {
return $.summernote.ui.button({
contents: '<span class="note-fontsize-10">75%</span>',
tooltip: 'Уменьшить до 75%',
click: context.createInvokeHandler("editor.resize", "0.75")
}).render()
}
$.summernote.options.buttons['resize75'] = ImageResize75PercentButton
$.summernote.options.popover.image = [
["resize", ["resizeFull", "resize75", "resizeHalf", "resizeQuarter", "resizeNone"]],
["float", ["floatLeft", "floatRight", "floatNone"]],
["remove", ["removeMedia"]],
]
Add it as Summernote JS plugin.