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 8524803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:47:30+00:00 2026-06-11T07:47:30+00:00

I am trying to insert a button into HtmlEditor’s ToolBar. Button should get selected

  • 0

I am trying to insert a button into HtmlEditor’s ToolBar. Button should get selected text by mouse or keyboard and add ‘#’ character at the start of that selected text for locating it as a url.

As i understand the best solution is creating a plugin for adding buttons into html editor toolbar. I found creation codes but the problem is; how can i get selected text? Ext-js version 2.2

And there is the code that provides to create a plugin for html editor toolbar button:

Ext.ns('Ext.ux.form.HtmlEditor');

    Ext.ux.form.HtmlEditor.NewLine = Ext.extend(Ext.util.Observable, {
        init:function (cmp) {
            this.cmp = cmp;
            this.cmp.on('render', this.onRender, this);
        },
        onRender:function () {
            this.cmp.getToolbar().addButton([
                {
                    iconCls:'newline', //your iconCls here
                    handler:function () {
                        this.cmp.insertAtCursor('<br>&nbsp;');

                    },
                    scope:this
                }
            ]);
        }
    });
  • 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-06-11T07:47:31+00:00Added an answer on June 11, 2026 at 7:47 am

    You can get the selected text like this: window.getSelection()

    That gives you a Selection object. If you want to get the text only: window.getSelection().toString()

    but if you want to make stuff bold or something, you need to check if the selection is inside the editor. Everything you need for that is inside the selection object.

    => correction: the htmlEditor uses an iframe you can get the iframe window by the getWin function.

    Note that this is only for modern browser (not < IE9) judging from the legacy Ext version you use, that might be an issue for you… but there are workarounds for IE.

    more info

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

Sidebar

Related Questions

I'm trying to add a button into the Gmail compose toolbar at the Insert
Trying to insert 315K Gif files into an Oracle 10g database. Everytime I get
I am trying to work out how to insert a tab character into a
I'm trying to programmatically insert a dijit.form.Button into some HTML and my code goes
I am trying to insert some text into <textarea> by query but it is
I'm trying to authenticate before using ajax to insert into a database $('#button').click(function ()
I'm trying to insert a text into a UITextField . But by insert, I
I'm trying to insert a paypal button using their code into the HTML tab
I am trying to insert a button column into a datatable but it says
I'm trying to create a post button that inserts the latest posts into a

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.