define(["sugar-web/graphics/palette"], function (palette) {
'use strict';
var textpalette = {};
textpalette.TextPalette = function (textButton, toonModel, title) {
palette.Palette.call(this, textButton);
this.getPalette().id = "text-palette";
var containerElem = document.createElement('div');
var content = '
' +
'' +
'
' +
'' +
'' +
'
';
var styleToolbar = '' +
'' +
'' +
'' +
''+
'
';
content = content + styleToolbar;
var colors = ['#000000', '#ff0000', '#00008b', '#006400', '#8b008b',
'#c0c0c0', '#ffd700', '#008000', '#ff4500', '#8b4513' ];
content = content + '';
for (var i = 0; i < colors.length; i++) {
content = content + ' | ';
if (i == 4) {
content = content + '
';
};
};
content = content + '
';
containerElem.innerHTML = content;
this.setContent([containerElem]);
this.editorElem = containerElem.querySelector('#editor');
this.colorButtons = document.querySelectorAll(".color-picker");
this.incTextBtn = containerElem.querySelector('#text-inc-size');
this.decTextBtn = containerElem.querySelector('#text-dec-size');
this.boldTextBtn = containerElem.querySelector('#text-set-bold');
this.italicTextBtn = containerElem.querySelector('#text-set-italic');
};
var setText = function (text) {
this.editorElem.value = text;
};
textpalette.TextPalette.prototype =
Object.create(palette.Palette.prototype, {
setText: {
value: setText,
enumerable: true,
configurable: true,
writable: true
}
});
return textpalette;
});