Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3405278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:29:10+00:00 2026-05-18T05:29:10+00:00

I am looking to create a custom button on the TinyMCE toolbar that wraps

  • 0

I am looking to create a custom button on the TinyMCE toolbar that wraps the currently selected content in a div with a class. I am using drupal 6.19 with wysiwyg-dev and TinyMCE 3.3.9.2.

Sample text:

<h3>Heading</h3>
<p>Sample text</p>
<ul>
   <li>item 1</li>
   <li>item 2</li>
</ul>
<p>more text</p>

Sample text that has been highlighted and had the ‘button’ pressed:

<div class="note">
   <h3>Heading</h3>
   <p>Sample text</p>
   <ul>
      <li>item 1</li>
      <li>item 2</li>
   </ul>
   <p>more text</p>
</div>

I have read through a few forums on the internet, and have found people that have come close to solving this. Some use a custom TinyMCE plugin as in this guy http://forum.cmsmadesimple.org/index.php?topic=44093.0

Some say that the new TinyMCE version 3.3 now has the ability to do this through the ‘formats’ variable on when you initialise TinyMCE – http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=73468

My question is – what is the best way to accomplish this using drupal? I am yet to get any of the above working

UPDATE

Have solved the issue now, Jeremy was right below, and I knew his answer was technically the correct answer, I was mainly asking if anyone else had done similiar work to this and had already created a module etc.

Anyway, in case anyone else comes across this problem, here are the files:

  • drupal_module_wysiwyg_wrapped_div_1.0.zip
  • tinymce_plugin_wrapped_div_1.0.zip

Let me know if you find these files useful 😉

Thanks
Sean

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:29:11+00:00Added an answer on May 18, 2026 at 5:29 am

    I’m assuming here that you have the button working and are trying to get it to work through Drupal.

    If not, that is your first step. Split the problem into an implementation problem and an integration problem.

    Once you have that working in a stand alone situation you can then create a module to implement it with Drupal.

    You will need to create a module which implements hook_wysiwyg_plugin() to create the button as an option in the wysiwyg settings page.

    Have a look at the IMCE wysiwyg bridge module, it implements a button on tinymce through Drupal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to create an expression tree by parsing xml using C#. The
If I were looking to create my own language are there any tools that
I'm writing a web app that points to external links. I'm looking to create
For a hw assignment, we were supposed to create a custom button to get
I'm looking to create a custom date picker with code examples from several sources.
I'm looking to create my own custom Sort By Date and Sort By Number
I am looking for an example of how to create a custom form builder
Recently I've been looking to create some way of showing a user that something
I'm looking to create favicon.ico files programatically from Python, but PIL only has support
I am looking to create symlinks (soft links) from Java on a Windows Vista/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.