/*! * VisualEditor user interface MWSyntaxHighlightDialog class. * * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * SimpleSurface is designed for MWSyntaxHighlight nodes which contains node model data and view. * Not compatible with other nodes. * * @class * @extends OO.ui.Element * * @constructor * @param {String} data MWSyntaxHighlight model data * @param {String} lang The language being edited */ ve.ui.MWSyntaxHighlightSimpleSurface = function VeUiMWSyntaxHighlightSimpleSurface( data, lang ) { // Parent constructor OO.ui.Element.call( this ); // Surface properties this.lang = lang; // Character dimension; in px this.charDimension = { 'height' : 0, 'width' : 0 }; // Node model data and tokenized data this.model = data; this.tokens = null; // Helpers this.tokenizer = null; this.highlighter = null; // Edit stack this.undoStack = []; this.redoStack = []; // Mouse input properties this.mouseDown = false; this.mouseMove = false; this.cursorInterval = null; // Cursor blink timer this.selection = { 'view' : { 'start' : { 'x' : 0, 'y' : 0 }, 'end' : { 'x' : 0, 'y' : 0 } }, 'model' : { 'start': 0, 'end' : 0 }, 'modelSorted' : { 'start': 0, 'end' : 0 } }; this.modelUnseleted = { 'left': '', 'right':'' }; // Key input properties this.input = { 'start' : -1, 'old' : '', 'newer' : '', 'pushReady' : false }; this.inputPushDelimiter = /\W/; // Cache this.cache = { 'editboxHeight': Infinity, 'editboxScroll': 0 }; // Element properties // Toolbar this.$toolbarLayer = this.$$( '
' ); this.$toolbar = this.$$( '
' ); this.$buttonUndo = this.$$( '' ); this.$buttonRedo = this.$$( '' ); this.$buttonIndent = this.$$( '' ); this.$buttonBeautify = this.$$( '' ); this.$langDropdown = this.$$( '