1.1 --- a/ckeditor/plugins/crossreference/README.md Sat Dec 17 03:31:51 2016 +0300
1.2 +++ b/ckeditor/plugins/crossreference/README.md Wed Dec 21 17:20:19 2016 +0300
1.3 @@ -5,7 +5,26 @@
1.4
1.5 ## Online demo
1.6
1.7 -Try the plugin demo at <http://indvd00m.com/crossreference/>.
1.8 +Try the plugin demo at <http://indvd00m.com/crossreference-demo/>.
1.9 +
1.10 +## CKEditor plugin page
1.11 +
1.12 +http://ckeditor.com/addon/crossreference
1.13 +
1.14 +## Requirements
1.15 +
1.16 +CrossReference Plugin require CKEditor 4.5+ version and dependent from plugins: dialog, notification.
1.17 +
1.18 +## Installation
1.19 +
1.20 + 1. Download the plugin: https://github.com/indvd00m/crossreference/releases.
1.21 +
1.22 + 2. Extract (decompress) the downloaded file into the plugins folder of your
1.23 + CKEditor installation.
1.24 + Example: http://example.com/ckeditor/plugins/crossreference
1.25 +
1.26 + 3. Enable the plugin by using the extraPlugins configuration setting.
1.27 + Example: CKEDITOR.config.extraPlugins = 'crossreference';
1.28
1.29 ## Description
1.30
1.31 @@ -122,7 +141,7 @@
1.32 | --- | --- | --- | --- |
1.33 | `activeTypes` | Which type of anchors would be activated. | Array | `['chapter', 'image', 'table', 'reference']` |
1.34 | `overrideTypes` | If you define your own types, enabling this option lead to mixing of your types with types from default config which not yet defined in your config. | Boolean | false |
1.35 -| `types` | Types definition. | Object | see [Default config](https://github.com/indvd00m/crossreference#default-config) section|
1.36 +| `types` | Types definition. | Object | see [Example of type definition](https://github.com/indvd00m/crossreference#example-of-type-definition) section|
1.37
1.38 ### Example of type definition
1.39
1.40 @@ -150,7 +169,7 @@
1.41 | `anchorTextTemplate` | Template for anchor text. This text will be put in `a` tag. You can use variables in format `${variableName}`. Variables is a properties of an anchor object (see [Example of an anchor object](https://github.com/indvd00m/crossreference#example-of-an-anchor-object) section). | String | No |
1.42 | `linkTextTemplate` | Template for link text. This text will be put in `a` tag. You can use variables in format `${variableName}`. Variables is a properties of an anchor object (see [Example of an anchor object](https://github.com/indvd00m/crossreference#example-of-an-anchor-object) section). | String | No |
1.43 | `numeration` | Definition of type numeration. See [Example of a numeration definition](https://github.com/indvd00m/crossreference#example-of-a-numeration-definition) section. | Object | No |
1.44 -| `anchorsProvider` | See [Example of type with anchors provider](https://github.com/indvd00m/crossreference#example-of-type-with-anchors-provider) section. | String 'default' or function | No |
1.45 +| `anchorsProvider` | See [Example of type with anchors provider](https://github.com/indvd00m/crossreference#example-of-type-with-anchors-provider) section. | String `'default'` or function | No |
1.46 | `allowCreateAnchors` | Can user create anchors of this type in anchors dialog. | Boolean | No |
1.47 | `groupAnchors` | If `true`, anchors can be filtered by group in link dialog. | Boolean | No |
1.48
1.49 @@ -231,21 +250,6 @@
1.50 | `editor` | Instance of ckeditor. | Object |
1.51
1.52
1.53 -## Requirements
1.54 -
1.55 -CrossReference Plugin require CKEditor 4.5+ version and dependent from plugins: dialog, notification.
1.56 -
1.57 -## Installation
1.58 -
1.59 - 1. Download the plugin: https://github.com/indvd00m/crossreference/releases.
1.60 -
1.61 - 2. Extract (decompress) the downloaded file into the plugins folder of your
1.62 - CKEditor installation.
1.63 - Example: http://example.com/ckeditor/plugins/crossreference
1.64 -
1.65 - 3. Enable the plugin by using the extraPlugins configuration setting.
1.66 - Example: CKEDITOR.config.extraPlugins = 'crossreference';
1.67 -
1.68 ## Roadmap
1.69
1.70 See https://github.com/indvd00m/crossreference/issues.
2.1 --- a/ckeditor/plugins/crossreference/dialogs/crossreference-anchor.js Sat Dec 17 03:31:51 2016 +0300
2.2 +++ b/ckeditor/plugins/crossreference/dialogs/crossreference-anchor.js Wed Dec 21 17:20:19 2016 +0300
2.3 @@ -88,7 +88,7 @@
2.4 this.element = selection.getStartElement();
2.5 if (this.element)
2.6 this.element = this.element.getAscendant('a', true);
2.7 - if (!this.element || this.element.getName() != 'a') {
2.8 + if (!this.element || this.element.getName() != 'a' || !this.element.hasAttribute('cross-anchor')) {
2.9 this.element = editor.document.createElement('a');
2.10 var guid = generateUUID();
2.11 this.element.setAttribute('cross-guid', guid);
2.12 @@ -97,7 +97,9 @@
2.13 this.insertMode = false;
2.14 }
2.15
2.16 - if (!this.insertMode)
2.17 + if (this.insertMode)
2.18 + this.setValueOf('tab-main', 'name', selection.getSelectedText().trim());
2.19 + else
2.20 this.setupContent(this.element);
2.21 },
2.22
3.1 --- a/ckeditor/plugins/crossreference/dialogs/crossreference-link.js Sat Dec 17 03:31:51 2016 +0300
3.2 +++ b/ckeditor/plugins/crossreference/dialogs/crossreference-link.js Wed Dec 21 17:20:19 2016 +0300
3.3 @@ -14,8 +14,6 @@
3.4 if (typeName)
3.5 type = config.types[typeName];
3.6
3.7 - dialog.setValueOf('tab-main', 'filter', '');
3.8 -
3.9 var anchorSelect = dialog.getContentElement('tab-main', 'anchor');
3.10 anchorSelect.clear();
3.11 anchorSelect.add('', '');
3.12 @@ -59,7 +57,9 @@
3.13 option.html(text);
3.14 });
3.15
3.16 - if (!dialog.insertMode)
3.17 + if (dialog.insertMode)
3.18 + filterAnchors(dialog);
3.19 + else
3.20 anchorSelect.setup(dialog.element);
3.21
3.22 dialog.setState(CKEDITOR.DIALOG_STATE_IDLE);
3.23 @@ -208,7 +208,7 @@
3.24 this.element = selection.getStartElement();
3.25 if (this.element)
3.26 this.element = this.element.getAscendant('a', true);
3.27 - if (!this.element || this.element.getName() != 'a') {
3.28 + if (!this.element || this.element.getName() != 'a' || !this.element.hasAttribute('cross-link')) {
3.29 this.element = editor.document.createElement('a');
3.30 this.element.setAttribute('cross-link', '');
3.31 this.insertMode = true;
3.32 @@ -216,9 +216,10 @@
3.33 this.insertMode = false;
3.34 }
3.35
3.36 - if (this.insertMode)
3.37 + if (this.insertMode) {
3.38 + this.setValueOf('tab-main', 'filter', selection.getSelectedText().trim());
3.39 updateAnchors(this);
3.40 - else
3.41 + } else
3.42 this.setupContent(this.element);
3.43 },
3.44
4.1 --- a/ckeditor/plugins/crossreference/plugin.js Sat Dec 17 03:31:51 2016 +0300
4.2 +++ b/ckeditor/plugins/crossreference/plugin.js Wed Dec 21 17:20:19 2016 +0300
4.3 @@ -189,6 +189,15 @@
4.4 }
4.5 }
4.6 });
4.7 +
4.8 + // keystrokes
4.9 +
4.10 + editor.setKeystroke(CKEDITOR.CTRL + CKEDITOR.SHIFT + 65, anchorDialogCmdName);
4.11 + editor.setKeystroke(CKEDITOR.CTRL + CKEDITOR.SHIFT + 76, linkDialogCmdName);
4.12 + editor.setKeystroke(CKEDITOR.CTRL + CKEDITOR.ALT + 85, updateCmdName);
4.13 +
4.14 + // double click
4.15 +
4.16 editor.on('doubleclick', function(evt) {
4.17 if (evt.data.element && !evt.data.element.isReadOnly() && evt.data.element.getName() === 'a'
4.18 && evt.data.element.hasAttribute('cross-reference')) {