http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94974
Revision: 94974
Author: tparscal
Date: 2011-08-19 00:38:11 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
To be forever known as "The Great UI Cleanup of 2011"
Modified Paths:
--------------
trunk/parsers/wikidom/demos/es/index.html
Added Paths:
-----------
trunk/parsers/wikidom/demos/es/es.css
trunk/parsers/wikidom/demos/es/es.js
trunk/parsers/wikidom/demos/es/images/bullet.png
trunk/parsers/wikidom/demos/es/images/data.png
trunk/parsers/wikidom/demos/es/images/fade-down.png
trunk/parsers/wikidom/demos/es/images/fade-up.png
trunk/parsers/wikidom/demos/es/images/indent.png
trunk/parsers/wikidom/demos/es/images/json.png
trunk/parsers/wikidom/demos/es/images/number.png
trunk/parsers/wikidom/demos/es/images/outdent.png
trunk/parsers/wikidom/demos/es/images/wikitext.png
Removed Paths:
-------------
trunk/parsers/wikidom/demos/es/index2.html
Added: trunk/parsers/wikidom/demos/es/es.css
===================================================================
--- trunk/parsers/wikidom/demos/es/es.css (rev 0)
+++ trunk/parsers/wikidom/demos/es/es.css 2011-08-19 00:38:11 UTC (rev
94974)
@@ -0,0 +1,99 @@
+body {
+ font-family: "Arial";
+ font-size: 1em;
+ width: 100%;
+ margin: 1em 0;
+ padding: 0;
+ overflow-y: scroll;
+ -webkit-user-select: none;
+}
+#es-toolbar,
+#es-panes {
+ margin-left: 1.5%;
+ width: 97%;
+ border: solid 1px #dddddd;
+}
+#es-toolbar {
+ border-bottom: none;
+ border-top-right-radius: 0.25em;
+ -webkit-border-top-right-radius: 0.25em;
+ -moz-border-top-right-radius: 0.25em;
+ -o-border-top-right-radius: 0.25em;
+ border-top-left-radius: 0.25em;
+ -webkit-border-top-left-radius: 0.25em;
+ -moz-border-top-left-radius: 0.25em;
+ -o-border-top-left-radius: 0.25em;
+ background-image: url(images/fade-up.png);
+ background-position: bottom left;
+ background-repeat: repeat-x;
+}
+.es-showData #es-visual,
+.es-showData #es-data {
+ width: 50%;
+ float: left;
+ overflow: hidden;
+}
+.es-showData #es-editor {
+ border-right: solid 1px #dddddd;
+}
+.es-toolbarGroup {
+ float: left;
+ padding: 0.25em;
+}
+.es-toolbarGroup-right {
+ float: right;
+ padding: 0.25em;
+}
+.es-toolbarDivider {
+ float: left;
+ width: 1px;
+ height: 24px;
+ margin: 0.5em 0 0.5em 0.5em;
+ background-color: #dddddd;
+}
+.es-toolbarLabel {
+ float: left;
+ padding: 0.5em 0.75em;
+ line-height: 22px;
+ font-size: 0.8em;
+ color: #555555;
+}
+.es-toolbarTool {
+ float: left;
+ padding: 0.25em;
+ border: solid 1px transparent;
+ border-radius: 0.125em;
+ -webkit-border-radius: 0.125em;
+ -moz-border-radius: 0.125em;
+ -o-border-radius: 0.125em;
+ cursor: pointer;
+}
+.es-toolbarTool:hover,
+.es-toolbarTool-down:hover {
+ border-color: #eeeeee;
+}
+.es-toolbarTool:active,
+.es-toolbarTool-down {
+ border-color: #dddddd;
+ background-image: url(images/fade-down.png);
+ background-position: top left;
+ background-repeat: repeat-x;
+}
+.es-toolbarTool img {
+ display: block;
+ width: 22px;
+ height: 22px;
+}
+#es-data {
+ display: none;
+}
+.es-showData #es-data {
+ display: block;
+}
+.es-code {
+ margin: 0;
+ padding: 1em;
+ white-space: pre-wrap;
+ font-family: "Droid Sans Mono", "Courier New", monospace;
+ font-size: 0.7em;
+}
Property changes on: trunk/parsers/wikidom/demos/es/es.css
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/parsers/wikidom/demos/es/es.js
===================================================================
--- trunk/parsers/wikidom/demos/es/es.js (rev 0)
+++ trunk/parsers/wikidom/demos/es/es.js 2011-08-19 00:38:11 UTC (rev
94974)
@@ -0,0 +1,257 @@
+$(document).ready( function() {
+ var showData = false;
+ doc = es.Document.newFromWikiDomDocument( { 'blocks': [
+ {
+ "type": "paragraph",
+ "lines": [
+ {
+ 'text': "In text display, line wrap is
the feature of continuing on a new line when a line is full, such that each
line fits in the viewable window, allowing text to be read from top to bottom
without any horizontal scrolling.",
+ 'annotations': [
+ // "In text display" should be
bold
+ { 'type': 'bold', 'range': {
'start': 0, 'end': 15 } },
+ // "line wrap" should be italic
+ { 'type': 'italic', 'range': {
'start': 17, 'end': 26 } },
+ // "wrap is" should be a link
to "#"
+ {
+ 'type': 'xlink',
+ 'data': { 'href': '#' },
+ 'range': { 'start': 22,
'end': 29 }
+ },
+ ]
+ },
+ { 'text': "Word wrap is the additional feature
of most text editors, word processors, and web browsers, of breaking lines
between and not within words, except when a single word is longer than a line."
},
+ ]
+ },
+ {
+ "type": "paragraph",
+ "lines": [
+ {
+ 'text': "It is usually done on the fly
when viewing or printing a document, so no line break code is manually entered,
or stored. If the user changes the margins, the editor will either
automatically reposition the line breaks to ensure that all the text will
\"flow\" within the margins and remain visible, or provide the typist some
convenient way to reposition the line breaks.",
+ 'annotations': [
+ // "[citation needed]" should
be super
+ {
+ 'type': 'template',
+ 'data': {
+ 'html':
'<sup><small><a href="#">[citation needed]</a></small></sup>'
+ },
+ 'range': { 'start':
120, 'end': 121 }
+ }
+ ]
+ },
+ { 'text': "A soft return is the break resulting
from line wrap or word wrap, whereas a hard return is an intentional break,
creating a new paragraph." },
+ ]
+ },
+ {
+ 'type': 'list',
+ 'style': 'number',
+ 'items': [
+ {
+ 'line': { 'text': 'Operating Systems' },
+ 'lists': [
+ {
+ 'style': 'bullet',
+ 'items': [
+ {
+ 'line':
{ 'text': 'Linux' },
+
'lists': [
+
{
+
'style': 'bullet',
+
'items': [
+
{
+
'line': { 'text': 'Ubuntu' },
+
'lists': [
+
{
+
'style': 'bullet',
+
'items': [
+
{
+
'line': {
+
'text':
'Desktop: Intuitive office apps, safe and fast web browsing, and seamless
integration. Ubuntu brings the very best technologies straight to the
desktop.',
+
'annotations': [
+
//
"[citation needed 2]" should be super
+
{
+
'type': 'template',
+
'data': {
+
'html': '<sup><small><a href="#">[citation needed 2]</a></small></sup>'
+
},
+
'range': { 'start': 85, 'end': 86 }
+
}
+
]
+
}
+
},
+
{ 'line': { 'text': 'Server:
Secure, fast and powerful, Ubuntu Server is transforming IT environments
worldwide. Realise the full potential of your infrastructure with a reliable,
easy-to-integrate technology platform. Lorem ipsum.. Lorem ipsum.. Lorem
ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum..
Lorem ipsum.. Lorem ipsum.. ' } },
+
{ 'line': { 'text': 'Cloud:
Ubuntu cloud computing puts you in control of your IT infrastructure. It helps
you access computing power as and when you need it so you can meet user demand
more effectively.' } }
+
]
+
}
+
]
+
},
+
{ 'line': { 'text': 'Fedora' } },
+
{ 'line': { 'text': 'Gentoo' } }
+
]
+
}
+ ]
+ },
+ { 'line': {
'text': 'Windows' } },
+ { 'line': {
'text': 'Mac' } }
+ ]
+ }
+ ]
+ },
+ {
+ 'line': {
+ 'text': 'Second item',
+ 'annotations': [
+ {
+ 'type':
'italic',
+ 'range': {
+
'start': 0,
+ 'end': 6
+ }
+ }
+ ]
+ }
+ },
+ {
+ 'line': {
+ 'text': 'Third item',
+ 'annotations': [
+ {
+ 'type': 'bold',
+ 'range': {
+
'start': 0,
+ 'end': 5
+ }
+ }
+ ]
+ }
+ },
+ {
+ 'line': {
+ 'text': 'Fourth item',
+ 'annotations': [
+ {
+ 'type': 'ilink',
+ 'range': {
+
'start': 7,
+ 'end':
11
+ },
+ 'data': {
'title': 'User:JohnDoe' }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ 'type': 'paragraph',
+ 'lines': [
+ { 'text': 'The soft returns are usually placed
after the ends of complete words, or after the punctuation that follows
complete words. However, word wrap may also occur following a hyphen.' },
+ { 'text': 'Word wrap following hyphens is
sometimes not desired, and can be avoided by using a so-called non-breaking
hyphen instead of a regular hyphen. On the other hand, when using word
processors, invisible hyphens, called soft hyphens, can also be inserted inside
words so that word wrap can occur following the soft hyphens.' },
+ { 'text': 'Sometimes, word wrap is not
desirable between words. In such cases, word wrap can usually be avoided by
using a hard space or non-breaking space between the words, instead of regular
spaces.' },
+ { 'text':
'OccasionallyThereAreWordsThatAreSoLongTheyExceedTheWidthOfTheLineAndEndUpWrappingBetweenMultipleLines.'
},
+ { 'text': 'Text might have\ttabs\tin it too.
Not all text will end in a line breaking character' }
+ ]
+ }
+ ] } );
+ var surface = new es.Surface( $('#es-editor'), doc );
+
+ $( '#es-toolbar .es-toolbarTool' ).mousedown( function( e ) {
+ e.preventDefault();
+ return false;
+ } );
+ $( '#es-toolbar-bold' ).click( function() {
+ surface.annotateContent( 'toggle', { 'type': 'bold' } );
+ return false;
+ } );
+ $( '#es-toolbar-italic' ).click( function() {
+ surface.annotateContent( 'toggle', { 'type': 'italic' } );
+ return false;
+ } );
+ $( '#es-toolbar-small' ).click( function() {
+ surface.annotateContent( 'toggle', {
+ 'type': 'size',
+ 'data': { 'type': 'small' }
+ } );
+ return false;
+ } );
+ $( '#es-toolbar-big' ).click( function() {
+ surface.annotateContent( 'toggle', {
+ 'type': 'size',
+ 'data': { 'type': 'big' }
+ } );
+ return false;
+ } );
+ $( '#es-toolbar-sub' ).click( function() {
+ surface.annotateContent( 'toggle', {
+ 'type': 'script',
+ 'data': { 'type': 'sub' }
+ } );
+ return false;
+ } );
+ $( '#es-toolbar-super' ).click( function() {
+ surface.annotateContent( 'toggle', {
+ 'type': 'script',
+ 'data': { 'type': 'super' }
+ } );
+ return false;
+ } );
+ $( '#es-toolbar-link' ).click( function() {
+ surface.annotateContent( 'toggle', {
+ 'type': 'xlink',
+ 'data': { 'href': '#' }
+ } );
+ return false;
+ } );
+ $( '#es-toolbar-clear' ).click( function() {
+ surface.annotateContent( 'remove', { 'type': 'all' } );
+ return false;
+ } );
+ $( '#es-toolbar-json' ).click( function() {
+ showData = showData === 'json' ? false : 'json';
+ if ( showData ) {
+ $( 'body' ).addClass( 'es-showData' );
+ $( '#es-json' ).show();
+ $( '#es-wikitext' ).hide();
+ $( '#es-toolbar-wikitext' ).removeClass(
'es-toolbarTool-down' );
+ $(this).addClass( 'es-toolbarTool-down' );
+ } else {
+ $( 'body' ).removeClass( 'es-showData' );
+ $(this).removeClass( 'es-toolbarTool-down' );
+ }
+ doc.renderBlocks();
+ doc.emit( 'update' );
+ } );
+ $( '#es-toolbar-wikitext' ).click( function() {
+ showData = showData === 'wikitext' ? false : 'wikitext';
+ if ( showData ) {
+ $( 'body' ).addClass( 'es-showData' );
+ $( '#es-wikitext' ).show();
+ $( '#es-json' ).hide();
+ $( '#es-toolbar-json' ).removeClass(
'es-toolbarTool-down' );
+ $(this).addClass( 'es-toolbarTool-down' );
+ } else {
+ $( 'body' ).removeClass( 'es-showData' );
+ $(this).removeClass( 'es-toolbarTool-down' );
+ }
+ doc.renderBlocks();
+ doc.emit( 'update' );
+ } );
+ // Setup data updates
+ var previewTimeout = null,
+ context = new es.Document.Context();
+ doc.on( 'update', function() {
+ if ( showData ) {
+ if ( previewTimeout !== null ) {
+ clearTimeout( previewTimeout );
+ }
+ previewTimeout = setTimeout( function () {
+ if ( showData === 'json' ) {
+ $( '#es-json' ).text( doc.serialize(
'json', context, {
+ 'indentWith': ' '
+ } ) );
+ } else if ( showData === 'wikitext' ) {
+ $( '#es-wikitext' ).text(
doc.serialize( 'wikitext', context ) );
+ }
+ }, 100 );
+ }
+ } );
+} );
\ No newline at end of file
Property changes on: trunk/parsers/wikidom/demos/es/es.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/parsers/wikidom/demos/es/images/bullet.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/bullet.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/data.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/data.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/fade-down.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/fade-down.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/fade-up.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/fade-up.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/indent.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/indent.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/json.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/json.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/number.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/number.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/outdent.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/outdent.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/parsers/wikidom/demos/es/images/wikitext.png
===================================================================
(Binary files differ)
Property changes on: trunk/parsers/wikidom/demos/es/images/wikitext.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/parsers/wikidom/demos/es/index.html
===================================================================
--- trunk/parsers/wikidom/demos/es/index.html 2011-08-19 00:36:17 UTC (rev
94973)
+++ trunk/parsers/wikidom/demos/es/index.html 2011-08-19 00:38:11 UTC (rev
94974)
@@ -4,51 +4,47 @@
<head>
<title>EditSurface Demo</title>
<link rel="stylesheet" href="../../lib/es/es.Surface.css">
- <style>
- body {
- font-family: "Arial";
- font-size: 1em;
- width: 100%;
- margin: 0;
- padding: 0;
- overflow-y: scroll;
- -webkit-user-select: none;
- }
- #es-toolbar,
- #es-editor {
- border: solid 1px silver;
- margin-left: 12.5%;
- margin-top: 1em;
- width: 75%;
- }
- .es-toolbarTool {
- float: left;
- width: 23px;
- height: 23px;
- margin: 0.5em 0 0.5em 0.5em;
- }
- .es-toolbarTool img {
- border: solid 1px white;
- cursor: pointer;
- }
- .es-toolbarTool img:hover {
- border-color: silver;
- }
- </style>
+ <link rel="stylesheet" href="es.css">
</head>
<body>
<div id="es-toolbar" class="es-toolbar">
- <div class="es-toolbarTool" id="es-toolbar-bold"><img
src="images/bold.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-italic"><img
src="images/italic.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-link"><img
src="images/link.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-small"><img
src="images/small.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-big"><img
src="images/big.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-sub"><img
src="images/sub.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-super"><img
src="images/super.png"></div>
- <div class="es-toolbarTool" id="es-toolbar-clear"><img
src="images/clear.png"></div>
+ <div class="es-toolbarGroup">
+ <div class="es-toolbarLabel">Text</div>
+ <div class="es-toolbarTool"
id="es-toolbar-bold"><img src="images/bold.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-italic"><img src="images/italic.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-link"><img src="images/link.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-small"><img src="images/small.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-big"><img src="images/big.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-sub"><img src="images/sub.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-super"><img src="images/super.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-clear"><img src="images/clear.png"></div>
+ <div style="clear:both"></div>
+ </div>
+ <div class="es-toolbarDivider"></div>
+ <div class="es-toolbarGroup">
+ <div class="es-toolbarLabel">Lists</div>
+ <div class="es-toolbarTool"
id="es-toolbar-bullet"><img src="images/bullet.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-number"><img src="images/number.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-indent"><img src="images/indent.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-outdent"><img src="images/outdent.png"></div>
+ <div style="clear:both"></div>
+ </div>
+ <div class="es-toolbarGroup es-toolbarGroup-right">
+ <div class="es-toolbarTool"
id="es-toolbar-json"><img src="images/json.png"></div>
+ <div class="es-toolbarTool"
id="es-toolbar-wikitext"><img src="images/wikitext.png"></div>
+ </div>
<div style="clear:both"></div>
</div>
- <div id="es-editor"></div>
+ <div id="es-panes">
+ <div id="es-visual">
+ <div id="es-editor"></div>
+ </div>
+ <div id="es-data">
+ <div id="es-wikitext" class="es-code"></div>
+ <div id="es-json" class="es-code"></div>
+ </div>
+ <div style="clear:both"></div>
+ </div>
<!-- EditSurface -->
<script src="../../lib/jquery.js"></script>
@@ -78,214 +74,6 @@
<script src="../../lib/es/es.Cursor.js"></script>
<!-- Demo -->
- <script>
- $(document).ready( function() {
- doc = es.Document.newFromWikiDomDocument( {
'blocks': [
- {
- "type": "paragraph",
- "lines": [
- {
- 'text': "In
text display, line wrap is the feature of continuing on a new line when a line
is full, such that each line fits in the viewable window, allowing text to be
read from top to bottom without any horizontal scrolling.",
- 'annotations': [
- // "In
text display" should be bold
- {
'type': 'bold', 'range': { 'start': 0, 'end': 15 } },
- //
"line wrap" should be italic
- {
'type': 'italic', 'range': { 'start': 17, 'end': 26 } },
- //
"wrap is" should be a link to "#"
- {
-
'type': 'xlink',
-
'data': { 'href': '#' },
-
'range': { 'start': 22, 'end': 29 }
- },
- ]
- },
- { 'text': "Word wrap is
the additional feature of most text editors, word processors, and web browsers,
of breaking lines between and not within words, except when a single word is
longer than a line." },
- ]
- },
- {
- "type": "paragraph",
- "lines": [
- {
- 'text': "It is
usually done on the fly when viewing or printing a document, so no line break
code is manually entered, or stored. If the user changes the margins, the
editor will either automatically reposition the line breaks to ensure that all
the text will \"flow\" within the margins and remain visible, or provide the
typist some convenient way to reposition the line breaks.",
- 'annotations': [
- //
"[citation needed]" should be super
- {
-
'type': 'template',
-
'data': {
-
'html': '<sup><small><a href="#">[citation needed]</a></small></sup>'
-
},
-
'range': { 'start': 120, 'end': 121 }
- }
- ]
- },
- { 'text': "A soft
return is the break resulting from line wrap or word wrap, whereas a hard
return is an intentional break, creating a new paragraph." },
- ]
- },
- {
- 'type': 'list',
- 'style': 'number',
- 'items': [
- {
- 'line': {
'text': 'Operating Systems' },
- 'lists': [
- {
-
'style': 'bullet',
-
'items': [
-
{
-
'line': { 'text': 'Linux' },
-
'lists': [
-
{
-
'style': 'bullet',
-
'items': [
-
{
-
'line': { 'text': 'Ubuntu' },
-
'lists': [
-
{
-
'style':
'bullet',
-
'items': [
-
{
-
'line': {
-
'text': 'Desktop: Intuitive office apps, safe and fast web browsing,
and seamless integration. Ubuntu brings the very best technologies straight to
the desktop.',
-
'annotations': [
-
// "[citation needed 2]" should be super
-
{
-
'type': 'template',
-
'data': {
-
'html': '<sup><small><a href="#">[citation
needed 2]</a></small></sup>'
-
},
-
'range': { 'start': 85, 'end': 86 }
-
}
-
]
-
}
-
},
-
{
'line': { 'text': 'Server: Secure, fast and powerful, Ubuntu Server is
transforming IT environments worldwide. Realise the full potential of your
infrastructure with a reliable, easy-to-integrate technology platform. Lorem
ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum..
Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. ' } },
-
{
'line': { 'text': 'Cloud: Ubuntu cloud computing puts you in control of your IT
infrastructure. It helps you access computing power as and when you need it so
you can meet user demand more effectively.' } }
-
]
-
}
-
]
-
},
-
{ 'line': { 'text': 'Fedora' } },
-
{ 'line': { 'text': 'Gentoo' } }
-
]
-
}
-
]
-
},
-
{ 'line': { 'text': 'Windows' } },
-
{ 'line': { 'text': 'Mac' } }
-
]
- }
- ]
- },
- {
- 'line': {
- 'text':
'Second item',
-
'annotations': [
-
{
-
'type': 'italic',
-
'range': {
-
'start': 0,
-
'end': 6
-
}
-
}
- ]
- }
- },
- {
- 'line': {
- 'text':
'Third item',
-
'annotations': [
-
{
-
'type': 'bold',
-
'range': {
-
'start': 0,
-
'end': 5
-
}
-
}
- ]
- }
- },
- {
- 'line': {
- 'text':
'Fourth item',
-
'annotations': [
-
{
-
'type': 'ilink',
-
'range': {
-
'start': 7,
-
'end': 11
-
},
-
'data': { 'title': 'User:JohnDoe' }
-
}
- ]
- }
- }
- ]
- },
- {
- 'type': 'paragraph',
- 'lines': [
- { 'text': 'The soft
returns are usually placed after the ends of complete words, or after the
punctuation that follows complete words. However, word wrap may also occur
following a hyphen.' },
- { 'text': 'Word wrap
following hyphens is sometimes not desired, and can be avoided by using a
so-called non-breaking hyphen instead of a regular hyphen. On the other hand,
when using word processors, invisible hyphens, called soft hyphens, can also be
inserted inside words so that word wrap can occur following the soft hyphens.'
},
- { 'text': 'Sometimes,
word wrap is not desirable between words. In such cases, word wrap can usually
be avoided by using a hard space or non-breaking space between the words,
instead of regular spaces.' },
- { 'text':
'OccasionallyThereAreWordsThatAreSoLongTheyExceedTheWidthOfTheLineAndEndUpWrappingBetweenMultipleLines.'
},
- { 'text': 'Text might
have\ttabs\tin it too. Not all text will end in a line breaking character' }
- ]
- }
- ] } );
- var surface = new es.Surface( $('#es-editor'),
doc );
-
- $( '#es-toolbar .es-toolbarTool' ).mousedown(
function( e ) {
- e.preventDefault();
- return false;
- } );
- $( '#es-toolbar-bold' ).click( function() {
- surface.annotateContent(
'toggle', { 'type': 'bold' } );
- return false;
- } );
- $( '#es-toolbar-italic' ).click( function() {
- surface.annotateContent( 'toggle', {
'type': 'italic' } );
- return false;
- } );
- $( '#es-toolbar-small' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'size',
- 'data': { 'type': 'small' }
- } );
- return false;
- } );
- $( '#es-toolbar-big' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'size',
- 'data': { 'type': 'big' }
- } );
- return false;
- } );
- $( '#es-toolbar-sub' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'script',
- 'data': { 'type': 'sub' }
- } );
- return false;
- } );
- $( '#es-toolbar-super' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'script',
- 'data': { 'type': 'super' }
- } );
- return false;
- } );
- $( '#es-toolbar-link' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'xlink',
- 'data': { 'href': '#' }
- } );
- return false;
- } );
- $( '#es-toolbar-clear' ).click( function() {
- surface.annotateContent( 'remove', {
'type': 'all' } );
- return false;
- } );
- } );
- </script>
+ <script src="es.js"></script>
</body>
</html>
Deleted: trunk/parsers/wikidom/demos/es/index2.html
===================================================================
--- trunk/parsers/wikidom/demos/es/index2.html 2011-08-19 00:36:17 UTC (rev
94973)
+++ trunk/parsers/wikidom/demos/es/index2.html 2011-08-19 00:38:11 UTC (rev
94974)
@@ -1,334 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <title>EditSurface Demo</title>
- <link rel="stylesheet" href="../../lib/es/es.Surface.css">
- <style>
- body {
- font-family: "Arial";
- font-size: 1em;
- width: 100%;
- margin: 0;
- padding: 0;
- overflow-y: scroll;
- -webkit-user-select: none;
- }
- #es-toolbar,
- #es-editor {
- border: solid 1px silver;
- margin-top: 1em;
- margin-left: auto;
- margin-right: auto;
- width: 95%;
- }
- .es-toolbarTool {
- float: left;
- width: 23px;
- height: 23px;
- margin: 0.5em 0 0.5em 0.5em;
- }
- .es-toolbarTool img {
- border: solid 1px white;
- cursor: pointer;
- }
- .es-toolbarTool img:hover {
- border-color: silver;
- }
- #source-wrapper {
- width: 95%;
- margin: auto;
- }
- .source {
- min-height: 150px;
- margin: 0;
- padding: 1em;
- border: solid 1px silver;
- white-space: pre-wrap;
- font-family: "Droid Sans Mono", monospace;
- font-size: 0.75em;
- }
- </style>
- </head>
- <body>
- <table width="100%">
- <tr valign="top">
- <td width="50%">
- <div id="es-toolbar" class="es-toolbar">
- <div class="es-toolbarTool"
id="es-toolbar-bold"><img src="images/bold.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-italic"><img src="images/italic.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-link"><img src="images/link.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-small"><img src="images/small.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-big"><img src="images/big.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-sub"><img src="images/sub.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-super"><img src="images/super.png"></div>
- <div class="es-toolbarTool"
id="es-toolbar-clear"><img src="images/clear.png"></div>
- <div style="clear:both"></div>
- </div>
- <div id="es-editor"></div>
- </td>
- <td width="50%">
- <div id="source-wrapper">
- <h3>Wikitext Source</h3>
- <div id="wikitext-source"
class="source"></div>
- <h3>JSON Source</h3>
- <div id="json-source"
class="source"></div>
- </div>
- </td>
- </tr>
- </table>
-
- <script src="../../lib/jquery.js"></script>
- <script src="../../lib/es/es.js"></script>
- <script src="../../lib/es/es.EventEmitter.js"></script>
- <script src="../../lib/es/es.Position.js"></script>
- <script src="../../lib/es/es.Location.js"></script>
- <script src="../../lib/es/es.Range.js"></script>
- <script src="../../lib/es/es.Selection.js"></script>
- <script src="../../lib/es/es.Content.js"></script>
- <script src="../../lib/es/es.Container.js"></script>
- <script src="../../lib/es/es.DomContainer.js"></script>
- <script src="../../lib/es/es.Block.js"></script>
- <script src="../../lib/es/es.Document.js"></script>
- <script src="../../lib/es/es.AnnotationSerializer.js"></script>
- <script src="../../lib/es/es.Document.Context.js"></script>
- <script src="../../lib/es/es.Document.Serializer.js"></script>
- <script
src="../../lib/es/es.Document.WikitextSerializer.js"></script>
- <script
src="../../lib/es/es.Document.HtmlSerializer.js"></script>
- <script
src="../../lib/es/es.Document.JsonSerializer.js"></script>
- <script src="../../lib/es/es.Surface.js"></script>
- <script src="../../lib/es/es.Flow.js"></script>
- <script src="../../lib/es/es.ParagraphBlock.js"></script>
- <script src="../../lib/es/es.ListBlockList.js"></script>
- <script src="../../lib/es/es.ListBlockItem.js"></script>
- <script src="../../lib/es/es.ListBlock.js"></script>
- <script src="../../lib/es/es.Cursor.js"></script>
-
- <!-- Demo -->
- <script>
- $(document).ready( function() {
- doc = es.Document.newFromWikiDomDocument( {
'blocks': [
- {
- "type": "paragraph",
- "lines": [
- {
- 'text': "In
text display, line wrap is the feature of continuing on a new line when a line
is full, such that each line fits in the viewable window, allowing text to be
read from top to bottom without any horizontal scrolling.",
- 'annotations': [
- // "In
text display" should be bold
- {
'type': 'bold', 'range': { 'start': 0, 'end': 15 } },
- //
"line wrap" should be italic
- {
'type': 'italic', 'range': { 'start': 17, 'end': 26 } },
- //
"wrap is" should be a link to "#"
- {
-
'type': 'xlink',
-
'data': { 'href': '#' },
-
'range': { 'start': 22, 'end': 29 }
- },
- ]
- },
- { 'text': "Word wrap is
the additional feature of most text editors, word processors, and web browsers,
of breaking lines between and not within words, except when a single word is
longer than a line." },
- ]
- },
- {
- "type": "paragraph",
- "lines": [
- {
- 'text': "It is
usually done on the fly when viewing or printing a document, so no line break
code is manually entered, or stored. If the user changes the margins, the
editor will either automatically reposition the line breaks to ensure that all
the text will \"flow\" within the margins and remain visible, or provide the
typist some convenient way to reposition the line breaks.",
- 'annotations': [
- //
"[citation needed]" should be super
- {
-
'type': 'template',
-
'data': {
-
'html': '<sup><small><a href="#">[citation needed]</a></small></sup>'
-
},
-
'range': { 'start': 120, 'end': 121 }
- }
- ]
- },
- { 'text': "A soft
return is the break resulting from line wrap or word wrap, whereas a hard
return is an intentional break, creating a new paragraph." },
- ]
- },
- /*
- {
- 'type': 'list',
- 'style': 'number',
- 'items': [
- {
- 'line': {
'text': 'Operating Systems' },
- 'lists': [
- {
-
'style': 'bullet',
-
'items': [
-
{
-
'line': { 'text': 'Linux' },
-
'lists': [
-
{
-
'style': 'bullet',
-
'items': [
-
{
-
'line': { 'text': 'Ubuntu' },
-
'lists': [
-
{
-
'style':
'bullet',
-
'items': [
-
{
-
'line': {
-
'text': 'Desktop: Intuitive office apps, safe and fast web browsing,
and seamless integration. Ubuntu brings the very best technologies straight to
the desktop.',
-
'annotations': [
-
// "[citation needed 2]" should be super
-
{
-
'type': 'template',
-
'data': {
-
'html': '<sup><small><a href="#">[citation
needed 2]</a></small></sup>'
-
},
-
'range': { 'start': 85, 'end': 86 }
-
}
-
]
-
}
-
},
-
{
'line': { 'text': 'Server: Secure, fast and powerful, Ubuntu Server is
transforming IT environments worldwide. Realise the full potential of your
infrastructure with a reliable, easy-to-integrate technology platform. Lorem
ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum..
Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. Lorem ipsum.. ' } },
-
{
'line': { 'text': 'Cloud: Ubuntu cloud computing puts you in control of your IT
infrastructure. It helps you access computing power as and when you need it so
you can meet user demand more effectively.' } }
-
]
-
}
-
]
-
},
-
{ 'line': { 'text': 'Fedora' } },
-
{ 'line': { 'text': 'Gentoo' } }
-
]
-
}
-
]
-
},
-
{ 'line': { 'text': 'Windows' } },
-
{ 'line': { 'text': 'Mac' } }
-
]
- }
- ]
- },
- {
- 'line': {
- 'text':
'Second item',
-
'annotations': [
-
{
-
'type': 'italic',
-
'range': {
-
'start': 0,
-
'end': 6
-
}
-
}
- ]
- }
- },
- {
- 'line': {
- 'text':
'Third item',
-
'annotations': [
-
{
-
'type': 'bold',
-
'range': {
-
'start': 0,
-
'end': 5
-
}
-
}
- ]
- }
- },
- {
- 'line': {
- 'text':
'Fourth item',
-
'annotations': [
-
{
-
'type': 'link',
-
'range': {
-
'start': 7,
-
'end': 11
-
},
-
'data': { 'title': 'User:JohnDoe' }
-
}
- ]
- }
- }
- ]
- },
- */
- {
- 'type': 'paragraph',
- 'lines': [
- { 'text': 'The soft
returns are usually placed after the ends of complete words, or after the
punctuation that follows complete words. However, word wrap may also occur
following a hyphen.' },
- { 'text': 'Word wrap
following hyphens is sometimes not desired, and can be avoided by using a
so-called non-breaking hyphen instead of a regular hyphen. On the other hand,
when using word processors, invisible hyphens, called soft hyphens, can also be
inserted inside words so that word wrap can occur following the soft hyphens.'
},
- { 'text': 'Sometimes,
word wrap is not desirable between words. In such cases, word wrap can usually
be avoided by using a hard space or non-breaking space between the words,
instead of regular spaces.' },
- { 'text': 'Text might
have\ttabs\tin it too. Not all text will end in a line breaking character' }
- ]
- }
- ] } );
- var surface = new es.Surface( $('#es-editor'),
doc );
-
- $( '#es-toolbar .es-toolbarTool' ).mousedown(
function( e ) {
- e.preventDefault();
- return false;
- } );
- $( '#es-toolbar-bold' ).click( function() {
- surface.annotateContent(
'toggle', { 'type': 'bold' } );
- return false;
- } );
- $( '#es-toolbar-italic' ).click( function() {
- surface.annotateContent( 'toggle', {
'type': 'italic' } );
- return false;
- } );
- $( '#es-toolbar-small' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'size',
- 'data': { 'type': 'small' }
- } );
- return false;
- } );
- $( '#es-toolbar-big' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'size',
- 'data': { 'type': 'big' }
- } );
- return false;
- } );
- $( '#es-toolbar-sub' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'script',
- 'data': { 'type': 'sub' }
- } );
- return false;
- } );
- $( '#es-toolbar-super' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'script',
- 'data': { 'type': 'super' }
- } );
- return false;
- } );
- $( '#es-toolbar-link' ).click( function() {
- surface.annotateContent( 'toggle', {
- 'type': 'xlink',
- 'data': { 'href': '#' }
- } );
- return false;
- } );
- $( '#es-toolbar-clear' ).click( function() {
- surface.annotateContent( 'remove', {
'type': 'all' } );
- return false;
- } );
-
- var previewTimeout = null,
- context = new es.Document.Context();
- doc.on( 'update', function() {
- if ( previewTimeout !== null ) {
- clearTimeout( previewTimeout );
- }
- previewTimeout = setTimeout( function
() {
- $( '#wikitext-source' ).text(
doc.serialize( 'wikitext', context ) );
- $( '#json-source' ).text(
- doc.serialize( 'json',
context, { 'indentWith': ' ' } )
- );
- }, 100 );
- } );
-
- } );
- </script>
- </body>
-</html>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
