19287

Listen to click events inside CKEditor dialog

Question:

I have a ckeditor instance, to which I added a custom dialog box using:

CKEDITOR.dialog.add('quicklinkDialog', function(editor) { return { title: 'Quick Links', minWidth: 400, minHeight: 200, contents: [ { id: 'tab1', label: 'Add a quick link', elements: [ { type: 'html', html: '

This is some text and then: <a href="">Click me!</a>

' }] }; });

I want to add a "click" event listener on the link inside my dialog box. When that link is clicked, content will be inserted into my textrea (the dialog box will also be closed).

Anyone knows how I might do this? Thanks in advance!

Answer1:

Here you go:

{ type: 'html', html: '

This is some text and then: <a href="">Click me!</a>

', onLoad: function( a ) { CKEDITOR.document.getById( this.domId ).on( 'click', function() { var dialog = this.getDialog(); dialog.hide(); dialog._.editor.insertHtml( this.html ); }, this ); } }

See the <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.dialog.definition" rel="nofollow">API</a> to know more.

Recommend

  • developer tools does not loads resources
  • Why does specifying Map's initial capacity cause subsequent serializations to give different re
  • How to Change StringTable Values stored in a .exe file
  • Difference between return View() and return View(new Model())
  • Unable to read FNC1 character at the first position of a GS1 128 Barcode using Zbar library?
  • Adding a watermark to a JTextArea
  • How to fetch data inside tag which is inside using python scraping
  • cmd error: 'ANT' is not recognized as an internal or external command
  • How to integrate Struts2 with Thymeleaf?
  • Manipulating a group view in a ExpandableListView from the child view
  • Custom test adapter installed via NuGet isn't discovering tests
  • Python - Pandas subtotals on groupby
  • Samples, isosamples, and how they affect contour lines
  • Define a symbol for an assembly (.s) source file in Android.mk?
  • Using a custom URL rewriter, IIS6, and urls with .htm, .html, etc
  • Show QMainwindow in the middle of the screen
  • Using simplemodal with wordpress
  • Failure to Read Updated AnyLogic DB Values
  • magento 2 rest api : get cart items with images
  • Copy Row if Cell Contains X to Different Sheet then delete row.
  • E: Malformed entry 1 in list file /etc/apt/sources.list.d/sbt.list (Suite)
  • Questions related to Garbage Collector and finalize() method
  • Modifying native query cannot have named parameter bindings?
  • Use AutoIt with java applications
  • Set SelectedIndex of ListView in FlipView_SelectionChanged event
  • Rotating Towards Path in OpenGL
  • concise way of flattening multiindex columns
  • Calculate time from document
  • 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs
  • Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version
  • Functions by reference or by variable, which to use when?
  • Apple Mach-O Linker error (“duplicate symbol”)