/** * VisualEditor Surface class. * * @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * Creates an ve.Surface object. * * A surface is a top-level object which contains both a surface model and a surface view. * * @class * @constructor * @param {String} parent Selector of element to attach to * @param {HTMLElement} html Document html * @param {Object} options Configuration options */ ve.Surface = function ( parent, dom, options ) { // Create linear model from HTML5 DOM var data = ve.dm.converter.getDataFromDom( dom ); // Properties this.parent = parent; this.currentMode = null; /* Extend VE configuration recursively */ this.options = ve.extendObject( true, { // Default options toolbars: { top: { tools: [{ 'name': 'history', 'items' : ['undo', 'redo'] }, { 'name': 'textStyle', 'items' : ['format'] }, { 'name': 'textStyle', 'items' : ['bold', 'italic', 'link', 'clear'] }, { 'name': 'list', 'items' : ['number', 'bullet', 'outdent', 'indent'] }] } } }, options ); // A place to store element references this.$base = null; this.$surface = null; this.toolbarWrapper = {}; // Create document model object with the linear model this.documentModel = new ve.dm.Document( data ); this.model = new ve.dm.Surface( this.documentModel ); // Setup VE DOM Skeleton this.setupBaseElements(); this.$surface = $( '