Coder Social home page Coder Social logo

Comments (10)

linkesch avatar linkesch commented on August 11, 2024

A basic idea behind why it's not incorporated yet is that if you want to deactivate the plugin, better would be not to include the plugin's JS file at all

from medium-editor-insert-plugin.

miloshadzic avatar miloshadzic commented on August 11, 2024

The reason I need it is so I can toggle editing programmatically. Not sure how I would do that with the present code. Any suggestions?

from medium-editor-insert-plugin.

linkesch avatar linkesch commented on August 11, 2024

You can try to extend $.fn.mediumInsert.insert.init() function to delete previously created placeholders. And then toggling the plugin would look like setting $.fn.mediumInsert.settings.images and $.fn.mediumInsert.settings.maps to false and then rerunning $.fn.mediumInsert.insert.init().

I don't know. I didn't try to program it. It's only my suggestion from looking on the code.

from medium-editor-insert-plugin.

misbach avatar misbach commented on August 11, 2024

I'm running into this problem as well. This plugin doesn't work well if you can't toggle between edit mode.

There needs to be a simple .deactivate() method like medium-editor has.

from medium-editor-insert-plugin.

miloshadzic avatar miloshadzic commented on August 11, 2024

@orthes Wish I could tackle this but I don't think my JS chops are up to it.

Would it make sense to have a function that delegates to all other functions if the plugin is enabled and is a noon if it's not? Then you wouldn't need to bind/rebind events.

from medium-editor-insert-plugin.

linkesch avatar linkesch commented on August 11, 2024

I'm working now on a way to disable the plugin. Expect the first solution soon.

from medium-editor-insert-plugin.

linkesch avatar linkesch commented on August 11, 2024

So here it is, added disable/enable methods: fcaa216

You can call them like this:

$(element).mediumInsert('disable');

Another nice feature is, that they are both connected to Medium Editor's own activate/deactivate functions. So if you deactivate the editor, the plugin is deactivated too. This also applies for activation.

from medium-editor-insert-plugin.

miloshadzic avatar miloshadzic commented on August 11, 2024

Awesome! Thanks a lot! 👍

from medium-editor-insert-plugin.

misbach avatar misbach commented on August 11, 2024

fantastic, thanks.

from medium-editor-insert-plugin.

mikebronner avatar mikebronner commented on August 11, 2024

Is there a way we can disable just the adding of more images, but retain the functionality to keep editing existing images? Thanks! :) (Sorry, I know this is insanely old, but seemed the most appropriate place to ask.)

from medium-editor-insert-plugin.

Related Issues (20)

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.