src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.js
changeset 1070 ea0c7ac589c4
parent 527 5dd1aa8bedd9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.js	Thu Nov 08 10:50:52 2018 +0100
@@ -0,0 +1,20 @@
+tinymce.PluginManager.add('internal_links', function(editor, url) {
+
+	editor.addButton('internal_links', {
+		icon: 'cloud-check',
+		tooltip: "Insert internal link",
+		image: '/--static--/pyams_content/img/external.png',
+		onclick: function() {
+			editor.windowManager.open({
+				title: "Insert internal link",
+				body: [
+					{type: 'textbox', name: 'title', label: 'Link title', value: editor.selection.getContent()},
+					{type: 'textbox', name: 'oid', label:'Internal number'}
+				],
+				onsubmit: function(e) {
+					editor.insertContent('<a href="oid://' + e.data.oid + '">' + e.data.title + '</a>');
+				}
+			});
+		}
+	})
+});