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

Custom elements? #28

Closed
hackuun opened this issue Nov 20, 2017 · 8 comments
Closed

Custom elements? #28

hackuun opened this issue Nov 20, 2017 · 8 comments

Comments

@hackuun
Copy link

hackuun commented Nov 20, 2017

Is it possible to extend functionality to use custom elements?

@chmln
Copy link
Owner

chmln commented Nov 22, 2017

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

@hackuun
Copy link
Author

hackuun commented Nov 22, 2017

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

@romainbx
Copy link

Some news about that ?

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

@chmln chmln closed this as completed in e2c3d9b Feb 18, 2018
@hackuun
Copy link
Author

hackuun commented Feb 18, 2018

@chmln cool. Can you please provide usage example?

@mycarrysun
Copy link

@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??

@chmln
Copy link
Owner

chmln commented May 31, 2018

@jonalxh
Copy link

jonalxh commented Nov 18, 2020

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.

@richardhedges
Copy link

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.

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

6 participants