Jump to content

Get only the selected text from UniSyntaxEdit


eduardosuruagy

Recommended Posts

16 hours ago, eduardosuruagy said:

It can be on the server side, I wanted to take the selected text and execute a command in the bank with it

Hello,

You can try to use this approach.

1. UniEdit1.Visible = False

2. UniSyntaxEdit1.ClientEvents.UniEvents -> 

function beforeInit(sender, config)
{
    config.listeners = {
        initialize: ()=> {
            sender.codeEditor.editor.doc.addEventListener('selectionchange', ()=> {
                //ajaxRequest(sender, 'selectionchange', ['selectedText=' + sender.codeEditor.selection()]);
                MainForm.UniEdit1.setValue(sender.codeEditor.selection())
            }, false);
        }
    }
}

3. Usage...

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  ShowMessage(UniEdit1.Text);
end;

 

Link to comment
Share on other sites

3 hours ago, Sherzod said:

Hello,

You can try to use this approach.

1. UniEdit1.Visible = False

2. UniSyntaxEdit1.ClientEvents.UniEvents -> 


function beforeInit(sender, config)
{
    config.listeners = {
        initialize: ()=> {
            sender.codeEditor.editor.doc.addEventListener('selectionchange', ()=> {
                //ajaxRequest(sender, 'selectionchange', ['selectedText=' + sender.codeEditor.selection()]);
                MainForm.UniEdit1.setValue(sender.codeEditor.selection())
            }, false);
        }
    }
}

3. Usage...


procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  ShowMessage(UniEdit1.Text);
end;

 

If I change the MainForm in that part MainForm.UniEdit1.setValue (sender.codeEditor.selection ()) and put a Frame works too?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...