以前のものを改良してみた。CSS
/* MyCode
----------------------------------------------- */
.mycodeT, .mycodeB {
font-family: consolas, "Courier New", courier, monospace;
padding: 3px 3px 3px;
}
.mycodeT {
margin: 1em 1em 0;
color: #e04000;
background: #ffc080;
font-weight: bold;
}
.mycodeB {
margin: 0 1em 1em;
color: black;
background: papayawhip;
border-width: 1px;
border-style: dashed;
border-color: maroon;
overflow: scroll;
word-wrap: normal;
}
ついでにAIRで成型用のツールを作ってみた。BloggerStyle
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
title="Sample"
invoke="invokeHandler()">
<mx:Style>
WindowedApplication
{
background-color:"0xffffff";
font-size:"12";
}
</mx:Style>
<mx:Script>
<![CDATA[
private static var TEMPLATE_TEXT:String = '<pre class="mycodeT">%name%</pre><pre class="mycodeB">%text%</pre>';
private function invokeHandler():void {
_srcName.setFocus();
}
private function changeHandler(event:Event):void
{
_dstText.text = format();
}
private function format():String
{
var name:String = escape(_srcName.text);
var text:String = escape(_srcText.text);
return TEMPLATE_TEXT.replace(/%name%/, name).replace(/%text%/, text);
}
private function escape(x:String):String
{
x = x.replace(/&/g, '&');
x = x.replace(/</g, '<');
x = x.replace(/>/g, '>');
x = x.replace(/"/g, '"');
return x;
}
]]>
</mx:Script>
<mx:HDividedBox width="100%" height="100%">
<mx:VBox width="50%" height="100%">
<mx:TextInput id="_srcName" width="100%" change="changeHandler(event)"/>
<mx:TextArea id="_srcText" width="100%" height="100%" change="changeHandler(event)"/>
</mx:VBox>
<mx:TextArea id="_dstText" width="50%" height="100%" editable="false"/>
</mx:HDividedBox>
</mx:WindowedApplication>
0 件のコメント:
コメントを投稿