Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

HTML Editor: How To Delete Specific Tools

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HTML Editor: How To Delete Specific Tools

    I cannot believe how often this gets asked and the complete lack of information on the subject.

    You can remove any control for the HTML Editor. The only catch is that you need to do it using JavaScript & jQuery.

    In order to effectively remove or hide tools, you do need to know a little bit about their layout:
    Code:
    var tools = jQuery('[id$="FIELD_NAME.TOOLBAR"]').children();
    Replace "FIELD_NAME" with the name of your textarea. It's the same name that you would use in {grid.Object}.getValue('D','FIELD_NAME');

    This is what's inside tools:
    • tools[0] = Style
    • tools[1] = Spacer1
    • tools[2] = Font Face
    • tools[3] = Spacer2
    • tools[4] = Font Size
    • tools[5] = Spacer3
    • tools[6] = Bold
    • tools[7] = Italic
    • tools[8] = Underline
    • tools[9] = Strikethrough
    • tools[10] = Superscript
    • tools[11] = Subscript
    • tools[12] = Spacer4
    • tools[13] = Font Color
    • tools[14] = Highlight
    • tools[15] = Background
    • tools[16] = Spacer5
    • tools[17] = Text Align Left
    • tools[18] = Text Align Center
    • tools[19] = Text Align Right
    • tools[20] = Justified
    • tools[21] = Spacer6
    • tools[22] = Outdent
    • tools[23] = Indent
    • tools[24] = Spacer7
    • tools[25] = Bullet List
    • tools[26] = Numbered List
    • tools[27] = Spacer8
    • tools[28] = Insert Symbol
    • tools[29] = Table
    • tools[30] = Link


    If you have no File/Image Insert buttons, then...
    • tools[31] = Spacer9
    • tools[32] = Clear Formatting
    • tools[33] = Spacer10
    • tools[34] = Toggle Code


    If you have File Insert but no Image Insert, then...
    • tools[31] = Insert File
    • tools[32] = Spacer9
    • tools[33] = Clear Formatting
    • tools[34] = Spacer10
    • tools[35] = Toggle Code


    If you have Image Insert but no File Insert, then...
    • tools[31] = Insert Image
    • tools[32] = Spacer9
    • tools[33] = Clear Formatting
    • tools[34] = Spacer10
    • tools[35] = Toggle Code


    If you have both File Insert and Image Insert, then...
    • tools[31] = Insert Image
    • tools[32] = Insert File
    • tools[33] = Spacer9
    • tools[34] = Clear Formatting
    • tools[35] = Spacer10
    • tools[36] = Toggle Code


    File Insert and Image Insert can be controlled in Alpha.

    The HTML Editor is dynamically generated pretty much every time it's displayed. There are no reliable IDs that you can fall back on to get the individual tools. Thus, you must use jQuery Selectors to "get" individual tools:
    Code:
    var Bold              = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Bold"]');
    var Italic            = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Italic"]');
    var Underline         = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Underline"]');
    var Strikethrough     = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Strikethrough"]');
    var Superscript       = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Superscript"]');
    var Subscript         = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Subscript"]');
    
    var FontColor         = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Font Color"]');
    var Highlight         = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Highlight Color"]');
    var Background        = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Background Color"]');
    
    var TextAlignLeft     = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Left"]');
    var TextAlignCenter   = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Center"]');
    var TextAlignRight    = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Right"]');
    var Justified         = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Justified"]');
    
    var Outdent           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Outdent"]');
    var Indent            = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Indent"]');
    
    var BulletList        = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Unordered List"]');
    var NumberedList      = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Ordered List"]');
    
    var InsertSymbol      = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Insert Symbol"]');
    var Table             = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Table"]');
    var Link              = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Insert Link"]');
    
    var ClearFormatting   = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Clear Format"]');
    var ToggleCode        = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Toggle Code"]');
    
    var InsertImage       = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Insert Image"]');
    var InsertFile        = jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Insert File"]');
    There are 3 special cases for Controls: Style, Fonts, and Font Size. They have no title. So, instead, we have to use table and nth() to get each control. These selectors only work if none of these tools have been removed. Once you delete one of these 3 tools from the DOM, their lookup logic changes:
    Code:
    var Style             = jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(0)');
    var Fonts             = jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(1)');
    var FontSize          = jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(2)');
    Spacers are another special case. They're accomplished using spans. Here's how you'd access each one before any of them are removed from the DOM:
    Code:
    var Spacer1           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(0)');
    var Spacer2           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(1)');
    var Spacer3           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(2)');
    var Spacer4           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(3)');
    var Spacer5           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(4)');
    var Spacer6           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(5)');
    var Spacer7           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(6)');
    var Spacer8           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(7)');
    var Spacer9           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(8)');
    var Spacer10          = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(9)');
    Hiding --- this hides the tools but they're still in the DOM:
    Code:
    //controls with titles:
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Insert Symbol"]').hide();
    
    //Hide tools in the HTML Editor
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(0)').hide();
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(2)').hide();
    
    
    //Hide spacers in the HTML Editor
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(0)').hide();
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(2)').hide();
    Deleting --- this completely removes these tools from the DOM:
    Code:
    // controls with titles:
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>[title="Toggle Code"]').remove();
    
    // Font Size & Styles, but not Fonts
    // Delete in descending nth order, less you want crazy bugs
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(2)').remove(); //deletes Font Size
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>table:nth(0)').remove(); //deletes Styles
    
    // Individual Spacers
    // Delete in descending nth order, less you want crazy bugs
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(9)').remove(); //deletes spacer 10
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(5)').remove(); //deletes spacer 6
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(2)').remove(); //deletes spacer 3
    After deleting spacers and any of Font Size, Fonts, or Styles, it changes the nth() property for other spacers. In the above, we delete spacer 10, 6, and 3. This is how you'd access the remaining spacers in the toolbar:
    Code:
    var Spacer1           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(0)');
    var Spacer2           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(1)');
    [B]var Spacer4           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(2)');[/B]
    var Spacer5           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(3)');
    [B]var Spacer7           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(4)');[/B]
    var Spacer8           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(5)');
    var Spacer9           = jQuery('[id$="FIELD_NAME.TOOLBAR"]>span:nth(6)');
    Lastly, here are two tips for deleting sets of controls:
    Code:
    //Hide Styles, Fonts, and Font Sizes in one line:
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>table').hide();
    
    //Delete all the spacers:
    jQuery('[id$="FIELD_NAME.TOOLBAR"]>span').remove();
    Happy Scripting!
    ---
    Sarah
    Alpha Anywhere latest pre-release

    #2
    Re: HTML Editor: How To Delete Specific Tools

    Sarah,

    The information you have provided in this thread is INVALUABLE. It really needs to have some kind of special access in the Hierarchy of the Forum and Documentation in general. This stuff is impossible to guess at.

    I found this thread only because you helped me in a reply to one of my posts. I then continued to search for what the other possible elements were that was related to this issue and I found this post. My lucky day, you just posted it earlier in the day.

    I have just three questions at this point:

    1. Is there an opposite method to "remove()", like "insert()" or "add()" etc. (ie. needed to place the "Toggle Code" back into view)

    2. I "REALLY NEED" to access a PRINTER link if it has one. What might be the syntax to access this printer if one is available.

    3. Where did you locate the definitive information listed above, I can't imagine you may have taken your own time to compile it. If
    so, I feel I owe you some money.

    Thanks in advance!
    Tom W.

    Comment


      #3
      Re: HTML Editor: How To Delete Specific Tools

      1: Yes. You could show/hide the toggle source button instead of removing it. Inserting? jQuery probably has functions for that. They're probably called "add()". jQuery API Documentation. I'll check in the morning. Though, I don't really recommend extending the toolbar... It's destroyed & created a lot.

      2: There is no printer button in the A5.HTMLEditor.

      3: Half a day. But at least a month to finally figure out & understand what Alpha was doing with toolbars and everything. Still don't know about extending the toolbar. I really don't recommend it...
      Alpha Anywhere latest pre-release

      Comment


        #4
        Re: HTML Editor: How To Delete Specific Tools

        Originally posted by Fulltimer View Post
        1. Is there an opposite method to "remove()", like "insert()" or "add()" etc. (ie. needed to place the "Toggle Code" back into view)
        InsertAfter and InsertBefore allow you to insert elements. So... for example:

        Code:
        jQuery('<span>Outdent:</span>').insertBefore('[id$="FIELD_NAME.TOOLBAR"]>[title="Outdent"]');
        ---
        Sarah
        Alpha Anywhere latest pre-release

        Comment


          #5
          Re: HTML Editor: How To Delete Specific Tools

          Hi Sarah and thanks for this great post, where do I need to put the code in order to make it work?

          Comment

          Working...
          X