v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
61
public/tinymce/classes/ui/Container.js
Normal file → Executable file
61
public/tinymce/classes/ui/Container.js
Normal file → Executable file
@ -22,9 +22,10 @@ define("tinymce/ui/Container", [
|
||||
"tinymce/ui/Collection",
|
||||
"tinymce/ui/Selector",
|
||||
"tinymce/ui/Factory",
|
||||
"tinymce/ui/KeyboardNavigation",
|
||||
"tinymce/util/Tools",
|
||||
"tinymce/ui/DomUtils"
|
||||
], function(Control, Collection, Selector, Factory, Tools, DomUtils) {
|
||||
], function(Control, Collection, Selector, Factory, KeyboardNavigation, Tools, DomUtils) {
|
||||
"use strict";
|
||||
|
||||
var selectorCache = {};
|
||||
@ -115,15 +116,41 @@ define("tinymce/ui/Container", [
|
||||
* for the first control in the container and focus that.
|
||||
*
|
||||
* @method focus
|
||||
* @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not.
|
||||
* @return {tinymce.ui.Collection} Current instance.
|
||||
*/
|
||||
focus: function() {
|
||||
var self = this;
|
||||
focus: function(keyboard) {
|
||||
var self = this, focusCtrl, keyboardNav, items;
|
||||
|
||||
if (self.keyNav) {
|
||||
self.keyNav.focusFirst();
|
||||
} else {
|
||||
self._super();
|
||||
if (keyboard) {
|
||||
keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
|
||||
|
||||
if (keyboardNav) {
|
||||
keyboardNav.focusFirst(self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
items = self.find('*');
|
||||
|
||||
// TODO: Figure out a better way to auto focus alert dialog buttons
|
||||
if (self.statusbar) {
|
||||
items.add(self.statusbar.items());
|
||||
}
|
||||
|
||||
items.each(function(ctrl) {
|
||||
if (ctrl.settings.autofocus) {
|
||||
focusCtrl = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ctrl.canFocus) {
|
||||
focusCtrl = focusCtrl || ctrl;
|
||||
}
|
||||
});
|
||||
|
||||
if (focusCtrl) {
|
||||
focusCtrl.focus();
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -187,7 +214,7 @@ define("tinymce/ui/Container", [
|
||||
// Construct item if needed
|
||||
if (!(item instanceof Control)) {
|
||||
// Name only then convert it to an object
|
||||
if (typeof(item) == "string") {
|
||||
if (typeof item == "string") {
|
||||
item = {type: item};
|
||||
}
|
||||
|
||||
@ -325,7 +352,7 @@ define("tinymce/ui/Container", [
|
||||
self.find('*').each(function(ctrl) {
|
||||
var name = ctrl.name(), value = ctrl.value();
|
||||
|
||||
if (name && typeof(value) != "undefined") {
|
||||
if (name && typeof value != "undefined") {
|
||||
data[name] = value;
|
||||
}
|
||||
});
|
||||
@ -343,14 +370,14 @@ define("tinymce/ui/Container", [
|
||||
* @return {String} HTML representing the control.
|
||||
*/
|
||||
renderHtml: function() {
|
||||
var self = this, layout = self._layout;
|
||||
var self = this, layout = self._layout, role = this.settings.role;
|
||||
|
||||
self.preRender();
|
||||
layout.preRender(self);
|
||||
|
||||
return (
|
||||
'<div id="' + self._id + '" class="' + self.classes() + '" role="' + this.settings.role + '">' +
|
||||
'<div id="' + self._id + '-body" class="' + self.classes('body') + '">'+
|
||||
'<div id="' + self._id + '" class="' + self.classes() + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' +
|
||||
'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
|
||||
(self.settings.html || '') + layout.renderHtml(self) +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
@ -386,6 +413,12 @@ define("tinymce/ui/Container", [
|
||||
});
|
||||
}
|
||||
|
||||
if (!self.parent()) {
|
||||
self.keyboardNav = new KeyboardNavigation({
|
||||
root: self
|
||||
});
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
@ -435,13 +468,13 @@ define("tinymce/ui/Container", [
|
||||
* @return {tinymce.ui.Container} Current container instance.
|
||||
*/
|
||||
reflow: function() {
|
||||
var i, items;
|
||||
var i;
|
||||
|
||||
if (this.visible()) {
|
||||
Control.repaintControls = [];
|
||||
Control.repaintControls.map = {};
|
||||
|
||||
items = this.recalc();
|
||||
this.recalc();
|
||||
i = Control.repaintControls.length;
|
||||
|
||||
while (i--) {
|
||||
|
Reference in New Issue
Block a user