79
81
LANG: this.get('lang'),
80
82
TITLE: this.get('title'),
84
LINKED_CSS: this.get('linkedcss'),
82
85
CONTENT: this.get('content'),
83
86
BASE_HREF: this.get('basehref'),
84
87
DEFAULT_CSS: Frame.DEFAULT_CSS,
85
88
EXTRA_CSS: extra_css
87
90
if (Y.config.doc.compatMode != 'BackCompat') {
88
Y.log('Adding Doctype to frame', 'info', 'frame');
89
html = Frame.DOC_TYPE + "\n" + html;
91
Y.log('Adding Doctype to frame: ' + Frame.getDocType(), 'info', 'frame');
93
//html = Frame.DOC_TYPE + "\n" + html;
94
html = Frame.getDocType() + "\n" + html;
91
96
Y.log('DocType skipped because we are in BackCompat Mode.', 'warn', 'frame');
155
160
if (e.pageX > 0 || e.pageY > 0) {
156
161
if (e.type.substring(0, 3) !== 'key') {
157
162
node = this._instance.one('win');
158
xy = this._iframe.getXY()
163
xy = this._iframe.getXY();
159
164
e.frameX = xy[0] + e.pageX - node.get('scrollLeft');
160
165
e.frameY = xy[1] + e.pageY - node.get('scrollTop');
247
253
if (k !== 'focus' && k !== 'blur' && k !== 'paste') {
248
254
//Y.log('Adding DOM event to frame: ' + k, 'info', 'frame');
249
255
if (k.substring(0, 3) === 'key') {
250
inst.on(k, kfn, inst.config.doc);
256
if (k === 'keydown') {
257
inst.on(k, fn, inst.config.doc);
259
inst.on(k, kfn, inst.config.doc);
252
262
inst.on(k, fn, inst.config.doc);
266
276
inst._use = inst.use;
267
277
inst.use = Y.bind(this.use, this);
269
278
this._iframe.setStyles({
270
279
visibility: 'inherit'
272
281
inst.one('body').setStyle('display', 'block');
283
this._fixIECursors();
287
* It appears that having a BR tag anywhere in the source "below" a table with a percentage width (in IE 7 & 8)
288
* if there is any TEXTINPUT's outside the iframe, the cursor will rapidly flickr and the CPU would occasionally
289
* spike. This method finds all <BR>'s below the sourceIndex of the first table. Does some checks to see if they
290
* can be modified and replaces then with a <WBR> so the layout will remain in tact, but the flickering will
292
* @method _fixIECursors
295
_fixIECursors: function() {
296
var inst = this.getInstance(),
297
tables = inst.all('table'),
298
brs = inst.all('br'), si;
300
if (tables.size() && brs.size()) {
302
si = tables.item(0).get('sourceIndex');
303
brs.each(function(n) {
304
var p = n.get('parentNode'),
305
c = p.get('children'), b = p.all('>br');
309
n.replace(inst.Node.create('<wbr>'));
311
if (n.get('sourceIndex') > si) {
313
n.replace(inst.Node.create('<wbr>'));
317
n.replace(inst.Node.create('<wbr>'));
292
344
//TODO Circle around and deal with CSS loading...
293
345
args.push(Y.bind(function() {
294
346
Y.log('Callback from final internal use call', 'info', 'frame');
347
if (inst.Selection) {
348
inst.Selection.DEFAULT_BLOCK_TAG = this.get('defaultblock');
295
351
this.fire('ready');
297
353
Y.log('Calling use on internal instance: ' + args, 'info', 'frame');
412
* @method _setLinkedCSS
413
* @description Set's the linked CSS on the instance..
415
_getLinkedCSS: function(urls) {
416
if (!Y.Lang.isArray(urls)) {
421
Y.each(urls, function(v) {
423
str += '<link rel="stylesheet" href="' + v + '" type="text/css">';
433
* @method _setLinkedCSS
434
* @description Set's the linked CSS on the instance..
436
_setLinkedCSS: function(css) {
438
var inst = this.getInstance();
356
445
* @method _setExtraCSS
357
446
* @description Set's the extra CSS on the instance..
596
* @method _handleFocus
597
* @description Does some tricks on focus to set the proper cursor position.
599
_handleFocus: function() {
600
var inst = this.getInstance(),
601
sel = new inst.Selection();
603
if (sel.anchorNode) {
604
Y.log('_handleFocus being called..', 'info', 'frame');
605
var n = sel.anchorNode,
606
c = n.get('childNodes');
609
if (c.item(0).test('br')) {
610
sel.selectNode(n, true, false);
612
if (c.item(0).test('p')) {
613
n = c.item(0).one('br.yui-cursor').get('parentNode');
614
sel.selectNode(n, true, false);
507
621
* @description Set the focus to the iframe
508
622
* @param {Function} fn Callback function to execute after focus happens
590
717
* @description The default css used when creating the document.
593
DEFAULT_CSS: 'html { height: 95%; } body { padding: 7px; background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } img { cursor: pointer !important; border: none; }',
595
//DEFAULT_CSS: 'html { } body { margin: -15px 0 0 -15px; padding: 7px 0 0 15px; display: block; background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; }',
596
//DEFAULT_CSS: 'html { height: 95%; } body { height: 100%; padding: 7px; margin: 0 0 0 -7px; postion: relative; background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } img { cursor: pointer !important; border: none; }',
597
//DEFAULT_CSS: 'html { margin: 0; padding: 0; border: none; border-size: 0; } body { height: 97%; margin: 0; padding: 0; display: block; background-color: gray; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; }',
720
//DEFAULT_CSS: 'html { height: 95%; } body { padding: 7px; background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } img { cursor: pointer !important; border: none; }',
721
DEFAULT_CSS: 'body { background-color: #fff; font: 13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } img { cursor: pointer !important; border: none; }',
601
725
* @description The template string used to create the iframe
728
//HTML: '<iframe border="0" frameBorder="0" marginWidth="0" marginHeight="0" leftMargin="0" topMargin="0" allowTransparency="true" width="100%" height="99%"></iframe>',
604
729
HTML: '<iframe border="0" frameBorder="0" marginWidth="0" marginHeight="0" leftMargin="0" topMargin="0" allowTransparency="true" width="100%" height="99%"></iframe>',
605
//HTML: '<iframe border="0" frameBorder="0" width="100%" height="99%"></iframe>',
608
732
* @property PAGE_HTML
609
733
* @description The template used to create the page when created dynamically.
612
PAGE_HTML: '<html dir="{DIR}" lang="{LANG}"><head><title>{TITLE}</title>{META}<base href="{BASE_HREF}"/><style id="editor_css">{DEFAULT_CSS}</style>{EXTRA_CSS}</head><body>{CONTENT}</body></html>',
736
PAGE_HTML: '<html dir="{DIR}" lang="{LANG}"><head><title>{TITLE}</title>{META}<base href="{BASE_HREF}"/>{LINKED_CSS}<style id="editor_css">{DEFAULT_CSS}</style>{EXTRA_CSS}</head><body>{CONTENT}</body></html>',
741
* @description Parses document.doctype and generates a DocType to match the parent page, if supported.
742
* For IE8, it grabs document.all[0].nodeValue and uses that. For IE < 8, it falls back to Frame.DOC_TYPE.
743
* @returns {String} The normalized DocType to apply to the iframe
745
getDocType: function() {
746
var dt = Y.config.doc.doctype,
747
str = Frame.DOC_TYPE;
750
str = '<!DOCTYPE ' + dt.name + ((dt.publicId) ? ' ' + dt.publicId : '') + ((dt.systemId) ? ' ' + dt.systemId : '') + '>';
752
if (Y.config.doc.all) {
753
dt = Y.config.doc.all[0];
755
if (dt.nodeType === 8) {
757
if (dt.nodeValue.toLowerCase().indexOf('doctype') !== -1) {
758
str = '<!' + dt.nodeValue + '>';
615
769
* @property DOC_TYPE
623
777
* @description The meta-tag for Content-Type to add to the dynamic document
626
META: '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">',
627
//META: '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>',
780
//META: '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">',
781
META: '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>',
759
}, '3.2.0' ,{skinnable:false, requires:['base', 'node', 'selector-css3', 'substitute']});
943
}, '3.3.0' ,{requires:['base', 'node', 'selector-css3', 'substitute'], skinnable:false});