GithubHelp home page GithubHelp logo

liluxdev / summernote-addclass Goto Github PK

View Code? Open in Web Editor NEW
32.0 6.0 16.0 12 KB

A plugin for summernote editor to allow user to add custom css classes (custom styling) to the selected elements

License: MIT License

JavaScript 100.00%

summernote-addclass's Introduction

summernote-addclass's People

Contributors

liluxdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

summernote-addclass's Issues

Applies Class to Selected Elements Outside of Editor

If you have another node on your page highlighted or has focus outside of the Summernote editor, it will still apply the class to the element, which is not desired.

Just an FYI for anyone in the future, I was able to fix this issue by replacing this line:

$node = $(document.getSelection().focusNode.parentElement, ".note-editable");

with this:

$node = $(".note-editable").find(document.getSelection().focusNode.parentElement);

Love this plugin though! Exactly what I was looking for!

Trigger summernote change event when dropdown buttons are clicked

Issue: Summernote not saving applied classes added via this plugin.

Resolution:
After much trial and error I appended the line

context.invoke('triggerEvent', 'change');

to the click function of the addclass plugin within the summernote-ext-addclass.js file.

This (seems to) resolve the issue where summernote does not recognize any additional class styling that is added if you do not trigger the summernote.change event after applying your classes (i.e. by typing other content after applying classes).

Probably should be added to the master branch but I haven't done enough testing on it to create a PR. If not then hopefully this saves someone else time to figure out.

Remove Class on Enter (and with Button) and when choosing new class

Hello, i am using your plugin for the first time and it is great! however i would like an option so that when i press enter, the class is removed, for example i put something in an alert and when i press enter it creates a new alert, i think it should jump to the next line but without class.

Another problem is that say i select the class alert-info, then if i choose alert-danger it just gets added to the list of classes, so it doesnt switch, it just adds the two classes together. I think it would be better to remove all classes before adding the new one so that you can switch without issue between two classes.

Also, would it be possible to remove the class with the remove style button? and on that note do you think it is possible to add the classes to the style button so as to have a unified style button?

Thanks for the great work!

unreachable code after return statement

I am using Firefox 66.0.5, Win 64bit, XAMPP, Summernote 0.8.9.
My console log says "unreachable code after return statement', but it works (tested with jumbotron etc). I even add my own class. Is it something to worry about ?

Still working?

I tried your demo/jsfiddle, and it shows styled elements, but I could not change them. Has an update to summernote done something with the capabilities of this plugin?

Thank you

Just want to say thank you for this ! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.