Coder Social home page Coder Social logo

Custom elements? about vue-wysiwyg HOT 8 CLOSED

chmln avatar chmln commented on May 20, 2024 1
Custom elements?

from vue-wysiwyg.

Comments (8)

chmln avatar chmln commented on May 20, 2024

Yes, this should definitely be possible.
The modular architecture will make this rather easy too.

from vue-wysiwyg.

hackuun avatar hackuun commented on May 20, 2024

I checked the sources but still unsure how to achieve that.
@chmln any pointers?

from vue-wysiwyg.

romainbx avatar romainbx commented on May 20, 2024

Some news about that ?

I would like to create my own modules (for toolbar buttons), but I dont see how to do it nicely.

from vue-wysiwyg.

hackuun avatar hackuun commented on May 20, 2024

@chmln cool. Can you please provide usage example?

from vue-wysiwyg.

mycarrysun avatar mycarrysun commented on May 20, 2024

@chmln why did you close the issue? Thinking a show HTML button would be very useful and was going to add as a custom element. Also wanted to add icons as a custom element. Any way to currently do this??

from vue-wysiwyg.

chmln avatar chmln commented on May 20, 2024

@mycarrysun look at e2c3d9b#diff-39e1dfe7260adc0ef53ec43cb1f8e58cR1

from vue-wysiwyg.

jonalxh avatar jonalxh commented on May 20, 2024

I dont understand how to set the method that will be called from the customModule. This is my code:

	customModules: [{
		title: "Fullscreen", 
		icon: "+",
		customAction() {
                    console.log("customAction ")			
		}
	}]

It does not work. Can you explain me how? I want to set the editor in fullscreen.

from vue-wysiwyg.

richardhedges avatar richardhedges commented on May 20, 2024

This is all I did to create a custom module:

Vue.use(wysiwyg, {
    customModules: [{
        title: 'moduleTitle',
        icon: 'ICON', // an SVG will suffice
        customAction(utils) {
            return [['insertHTML', `<span class="custom-class">${utils.getHTMLOfSelection()}</span>`, true]]
        }
    }]
})

My only issue right now is having it remove the span. Because it inserts HTML, it will probably need to be expanded upon to check if the highlighted selection already contains the element we're about to add, and remove it if necessary.

from vue-wysiwyg.

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.