86 onShow : function() { |
86 onShow : function() { |
87 var selection = editor.getSelection(); |
87 var selection = editor.getSelection(); |
88 this.element = selection.getStartElement(); |
88 this.element = selection.getStartElement(); |
89 if (this.element) |
89 if (this.element) |
90 this.element = this.element.getAscendant('a', true); |
90 this.element = this.element.getAscendant('a', true); |
91 if (!this.element || this.element.getName() != 'a') { |
91 if (!this.element || this.element.getName() != 'a' || !this.element.hasAttribute('cross-anchor')) { |
92 this.element = editor.document.createElement('a'); |
92 this.element = editor.document.createElement('a'); |
93 var guid = generateUUID(); |
93 var guid = generateUUID(); |
94 this.element.setAttribute('cross-guid', guid); |
94 this.element.setAttribute('cross-guid', guid); |
95 this.insertMode = true; |
95 this.insertMode = true; |
96 } else { |
96 } else { |
97 this.insertMode = false; |
97 this.insertMode = false; |
98 } |
98 } |
99 |
99 |
100 if (!this.insertMode) |
100 if (this.insertMode) |
|
101 this.setValueOf('tab-main', 'name', selection.getSelectedText().trim()); |
|
102 else |
101 this.setupContent(this.element); |
103 this.setupContent(this.element); |
102 }, |
104 }, |
103 |
105 |
104 onOk : function() { |
106 onOk : function() { |
105 if (!this.getValueOf('tab-main', 'type')) |
107 if (!this.getValueOf('tab-main', 'type')) |