Project

General

Profile

Feature #23780 » rtehtmlarea_feature_16047.patch

Administrator Admin, 2010-10-18 21:46

View differences:

typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail)
is_chrome : Ext.isChrome,
is_opera : Ext.isOpera,
// Compile some regular expressions
RE_htmlTag : /<.[^<>]*?>/g,
RE_tagName : /(<\/|<)\s*([^ \t\n>]+)/ig,
RE_head : /<head>((.|\n)*?)<\/head>/i,
RE_body : /<body>((.|\n)*?)<\/body>/i,
......
RE_url : /(([^:/?#]+):\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,})+\.[a-z]{2,5}(:[0-9]+)?(\/\S+)*)/i,
RE_blockTags : /^(body|p|h1|h2|h3|h4|h5|h6|ul|ol|pre|dl|dt|dd|div|noscript|blockquote|form|hr|table|caption|fieldset|address|td|tr|th|li|tbody|thead|tfoot|iframe)$/,
RE_closingTags : /^(p|blockquote|a|li|ol|ul|dl|dt|td|th|tr|tbody|thead|tfoot|caption|colgroup|table|div|b|bdo|big|cite|code|del|dfn|em|i|ins|kbd|label|q|samp|small|span|strike|strong|sub|sup|tt|u|var|abbr|acronym|font|center|object|embed|style|script|title|head)$/,
RE_noClosingTag : /^(img|br|hr|col|input|area|base|link|meta|param)$/
RE_noClosingTag : /^(img|br|hr|col|input|area|base|link|meta|param)$/,
RE_numberOrPunctuation : /[0-9.(),;:!¡?¿%#$'"_+=\\\/-]*/g
});
/***************************************************
* TROUBLESHOOTING
......
* @event HTMLAreaEventIframeReady
* Fires when the iframe style sheets become accessible
*/
'HTMLAreaEventIframeReady'
'HTMLAreaEventIframeReady',
/*
* @event HTMLAreaEventWordCountChange
* Fires when the word count may have changed
*/
'HTMLAreaEventWordCountChange'
);
this.addListener({
afterrender: {
......
return this.ownerCt.getTopToolbar();
},
/*
* Get a reference to the statusBar
*/
getStatusBar: function () {
return this.ownerCt.getBottomToolbar();
},
/*
* Get a reference to a button
*/
getButton: function (buttonId) {
......
return letBubble;
}
}
this.fireEvent('HTMLAreaEventWordCountChange', 100);
if (!event.altKey && !event.ctrlKey) {
// Detect URL in non-IE browsers
if (!Ext.isIE && (event.getKey() != Ext.EventObject.ENTER || (event.shiftKey && !Ext.isWebKit))) {
......
*/
initComponent: function () {
HTMLArea.StatusBar.superclass.initComponent.call(this);
// Build the deferred word count update task
this.updateWordCountLater = new Ext.util.DelayedTask(this.updateWordCount, this);
this.addListener({
render: {
fn: this.addComponents,
......
this.mon(this.ownerCt.toolbar, 'HTMLAreaEventToolbarUpdate', this.onUpdateToolbar, this);
// Monitor editor changing mode
this.mon(this.getEditor(), 'HTMLAreaEventModeChange', this.onModeChange, this);
// Monitor word count change
this.mon(this.ownerCt.iframe, 'HTMLAreaEventWordCountChange', this.onWordCountChange, this);
},
/*
* editorId should be set in config
......
* Create span elements to display when the status bar tree or a message when the editor is in text mode
*/
addComponents: function () {
this.statusBarWordCount = Ext.DomHelper.append(this.getEl(), {
id: this.editorId + '-statusBarWordCount',
tag: 'span',
cls: 'statusBarWordCount',
html: '&nbsp;'
}, true);
this.statusBarTree = Ext.DomHelper.append(this.getEl(), {
id: this.editorId + '-statusBarTree',
tag: 'span',
......
}
}, this);
}
this.updateWordCount();
this.noUpdate = false;
},
/*
* Handler when the word count may have changed
*/
onWordCountChange: function(delay) {
this.updateWordCountLater.delay(delay ? delay : 0);
},
/*
* Update the word count
*/
updateWordCount: function() {
var wordCount = 0;
if (this.getEditor().getMode() == 'wysiwyg') {
// Get the html content
var text = this.getEditor().getHTML();
if (!Ext.isEmpty(text)) {
// Replace html tags with spaces
text = text.replace(HTMLArea.RE_htmlTag, ' ');
// Replace html space entities
text = text.replace(/&nbsp;|&#160;/gi, ' ');
// Remove numbers and punctuation
text = text.replace(HTMLArea.RE_numberOrPunctuation, '');
// Get the number of word
wordCount = text.split(/\S\s+/g).length - 1;
}
}
// Update the word count of the status bar
this.statusBarWordCount.dom.innerHTML = wordCount ? ( wordCount + ' ' + HTMLArea.I18N.dialogs[(wordCount == 1) ? 'word' : 'words']) : '&nbsp;';
},
/*
* Adapt status bar to current editor mode
*
* @param string mode: the mode to which the editor got switched to
typo3/sysext/rtehtmlarea/htmlarea/locallang_dialogs.xml (copie de travail)
<label index="Remove language mark">Remove language</label>
<label index="statusBarStyle">Style</label>
<label index="statusBarReady">Ready</label>
<label index="word">word</label>
<label index="words">words</label>
</languageKey>
</data>
<orig_hash type="array">
typo3/sysext/rtehtmlarea/htmlarea/skins/default/htmlarea.css (copie de travail)
.htmlarea .statusBar .statusBarTree a:hover {
text-decoration: underline;
}
.htmlarea .statusBar .statusBarWordCount {
float: right;
}
/* Selectors for dialogue windows */
.htmlarea-window .x-panel-icon {
background-image: url("images/sprites/actions.png");
typo3/sysext/t3skin/rtehtmlarea/htmlarea.css (copie de travail)
.htmlarea .statusBar .statusBarTree a:hover {
text-decoration: underline;
}
.htmlarea .statusBar .statusBarWordCount {
float: right;
}
/* Selectors for dialogue windows */
.htmlarea-window .x-panel-icon {
background-image: url("images/sprites/actions.png");
    (1-1/1)