Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imageSize75 #77

Open
johndavemanuel opened this issue Oct 2, 2018 · 5 comments
Open

Add imageSize75 #77

johndavemanuel opened this issue Oct 2, 2018 · 5 comments

Comments

@johndavemanuel
Copy link

Is it possible to add option imageSize75?

I try to use this summernote-image-attributes.js but it does not work

@Thierig
Copy link

Thierig commented Nov 5, 2018

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?

@johndavemanuel
Copy link
Author

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

@sandeepsangole
Copy link

Hi John,

did you find solution for this ?

@johndavemanuel
Copy link
Author

Hi Sandeep!

Sorry but no luck for this

@DAVIDhaker
Copy link

DAVIDhaker commented Mar 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants