11 |
11 |
12 var type = null; |
12 var type = null; |
13 var typeName = dialog.getValueOf('tab-main', 'type'); |
13 var typeName = dialog.getValueOf('tab-main', 'type'); |
14 if (typeName) |
14 if (typeName) |
15 type = config.types[typeName]; |
15 type = config.types[typeName]; |
16 |
|
17 dialog.setValueOf('tab-main', 'filter', ''); |
|
18 |
16 |
19 var anchorSelect = dialog.getContentElement('tab-main', 'anchor'); |
17 var anchorSelect = dialog.getContentElement('tab-main', 'anchor'); |
20 anchorSelect.clear(); |
18 anchorSelect.clear(); |
21 anchorSelect.add('', ''); |
19 anchorSelect.add('', ''); |
22 |
20 |
206 onShow : function() { |
206 onShow : function() { |
207 var selection = editor.getSelection(); |
207 var selection = editor.getSelection(); |
208 this.element = selection.getStartElement(); |
208 this.element = selection.getStartElement(); |
209 if (this.element) |
209 if (this.element) |
210 this.element = this.element.getAscendant('a', true); |
210 this.element = this.element.getAscendant('a', true); |
211 if (!this.element || this.element.getName() != 'a') { |
211 if (!this.element || this.element.getName() != 'a' || !this.element.hasAttribute('cross-link')) { |
212 this.element = editor.document.createElement('a'); |
212 this.element = editor.document.createElement('a'); |
213 this.element.setAttribute('cross-link', ''); |
213 this.element.setAttribute('cross-link', ''); |
214 this.insertMode = true; |
214 this.insertMode = true; |
215 } else { |
215 } else { |
216 this.insertMode = false; |
216 this.insertMode = false; |
217 } |
217 } |
218 |
218 |
219 if (this.insertMode) |
219 if (this.insertMode) { |
|
220 this.setValueOf('tab-main', 'filter', selection.getSelectedText().trim()); |
220 updateAnchors(this); |
221 updateAnchors(this); |
221 else |
222 } else |
222 this.setupContent(this.element); |
223 this.setupContent(this.element); |
223 }, |
224 }, |
224 |
225 |
225 onOk : function() { |
226 onOk : function() { |
226 if (!this.getValueOf('tab-main', 'type')) |
227 if (!this.getValueOf('tab-main', 'type')) |