Page 1 of 1

How to make a custom "insert link" dialog

PostPosted: 13 Apr 2018 06:07
by davenovo
I am trying to give the ability in my application for the user to create some custom web pages that will appear in the application, i.e. they can create web pages for themselves within the app where they can store notes to themselves for example.

It is pretty easy, there is a table with "page name" and "page content" and I put the page content field into the TIWCGJQHTMLEditor and let them edit it.

The only issue is that I want them to be able to link from one of their custom pages to another. When inserting a link, drupal for example has a special "insert link" dialog that lets you choose a link type

linktype.png


If you chose "internal path" it lets you choose from a drop down list from all the pages in the CMS. Then, when generating a URL for the link, it generates something like

https://mydomain.com/?q=<page_name>

where <page_name> is the name they selected.

Is there a way to create a custom "insert link" dialog that will allow me to return a custom URL that the selected text will be linked to. I already know how to parse a link in the form of https://mydomain.com/?q=<page_name> to show the correct page, but I dont know how to let the user generate that link from the UI

Re: How to make a custom "insert link" dialog

PostPosted: 13 Apr 2018 21:32
by davenovo
Also, I am not wedded to this editor. If it is easier in the TinyMCE editor I can switch to that as well.

Re: How to make a custom "insert link" dialog

PostPosted: 17 Apr 2018 17:27
by Alexander Bulei
Hi davenovo,

Definitely, you need use the TinyMCE.

Please activate the Link plugin in TinyMCEOptions.Plugins. Then, you can add your internal pages urls into PluginSettings.Link.List property.

Example of json:

Code: Select all
[{title: 'My page 1', value: 'http://www.tinymce.com'},{title: 'My page 2', value: 'http://www.moxiecode.com'}]


Best Regards.