diff options
| author | lsces <lester@lsces.co.uk> | 2013-07-15 14:22:23 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2013-07-15 14:22:23 +0100 |
| commit | 6d4c4f12d15ae68d912972921997a8c5180c9aea (patch) | |
| tree | 104274447272d09617c483cf6b0ee79559c9fe6f /core/htmlparser/text.js | |
| parent | de6d09676a9527919813a4474cc28af554a35fe1 (diff) | |
| download | ckeditor-6d4c4f12d15ae68d912972921997a8c5180c9aea.tar.gz ckeditor-6d4c4f12d15ae68d912972921997a8c5180c9aea.tar.bz2 ckeditor-6d4c4f12d15ae68d912972921997a8c5180c9aea.zip | |
Upgrade to CKEditor V4
Directory structure changed so many files removed and replace in a new location
This batch is the delete and add
Diffstat (limited to 'core/htmlparser/text.js')
| -rw-r--r-- | core/htmlparser/text.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/core/htmlparser/text.js b/core/htmlparser/text.js new file mode 100644 index 0000000..96a6754 --- /dev/null +++ b/core/htmlparser/text.js @@ -0,0 +1,70 @@ +/** + * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + + 'use strict'; + +(function() { + /** + * A lightweight representation of HTML text. + * + * @class + * @extends CKEDITOR.htmlParser.node + * @constructor Creates a text class instance. + * @param {String} value The text node value. + */ + CKEDITOR.htmlParser.text = function( value ) { + /** + * The text value. + * + * @property {String} + */ + this.value = value; + + /** @private */ + this._ = { + isBlockLike: false + }; + }; + + CKEDITOR.htmlParser.text.prototype = CKEDITOR.tools.extend( new CKEDITOR.htmlParser.node(), { + /** + * The node type. This is a constant value set to {@link CKEDITOR#NODE_TEXT}. + * + * @readonly + * @property {Number} [=CKEDITOR.NODE_TEXT] + */ + type: CKEDITOR.NODE_TEXT, + + /** + * Filter this text node with given filter. + * + * @since 4.1 + * @param {CKEDITOR.htmlParser.filter} filter + * @returns {Boolean} Method returns `false` when this text node has + * been removed. This is an information for {@link CKEDITOR.htmlParser.element#filterChildren} + * that it has to repeat filter on current position in parent's children array. + */ + filter: function( filter ) { + if ( !( this.value = filter.onText( this.value, this ) ) ) { + this.remove(); + return false; + } + }, + + /** + * Writes the HTML representation of this text to a {CKEDITOR.htmlParser.basicWriter}. + * + * @param {CKEDITOR.htmlParser.basicWriter} writer The writer to which write the HTML. + * @param {CKEDITOR.htmlParser.filter} [filter] The filter to be applied to this node. + * **Note:** it's unsafe to filter offline (not appended) node. + */ + writeHtml: function( writer, filter ) { + if ( filter ) + this.filter( filter ); + + writer.text( this.value ); + } + } ); +})(); |
