Hi,
You can add the wrapping html code directly in the editor without changing the shortcode input. You can do so like this: <p>[dropcap]This[/dropcap] is a text.</p>
Thread Starter
Lunis
(@lunis)
Thanks. I was looking for a way to make work like that automatically – when pressing the D-button in the Visual Editor, though.
Best!
You need to change the code in the file includes/js/shortcode-button.js:15 and includes/js/shortcode-button.js:18.
Thread Starter
Lunis
(@lunis)
Yeah. Tried to change the code from
if( selected !== ' ' || selected !== null ) {
// if text is selected when button is clicked, wrap shortcode around it
content = '[dropcap]' + selected + '[/dropcap]';
} else {
// add shortcode without the selected text
content = '[dropcap][/dropcap]';
}
to
if( selected !== ' ' || selected !== null ) {
// if text is selected when button is clicked, wrap shortcode around it
content = '<p>[dropcap]' + selected + '[/dropcap]</p>';
} else {
// add shortcode without the selected text
content = '<p>[dropcap][/dropcap]</p>';
}
But nothing’s changed. It still inserts [dropcap]…[dropcap] when pressing the shortcode button.
I have almost no coding experience, sorry.
-
This reply was modified 6 years, 7 months ago by
Lunis.
-
This reply was modified 6 years, 7 months ago by
Lunis.
Try to clear your site and browser cache. It seems the modified JS script hasn’t been loaded. Your modified file looks good.