fix up /render/

pull/1/head
ansuz 8 years ago
parent 168338b898
commit fb21b4e46b

@ -2,7 +2,17 @@ html {
font-family: sans-serif; font-family: sans-serif;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
/*background-color: #073642;*/
color: #839496;
font-family: 'PT Sans', sans-serif;
}
body {
background-color: #002b36;
} }
a:focus { a:focus {
outline: thin dotted; outline: thin dotted;
} }
@ -39,13 +49,11 @@ table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }
html {
font-family: 'PT Sans', sans-serif;
}
pre, pre,
code { code {
font-family: 'Inconsolata', sans-serif; font-family: 'Inconsolata', sans-serif;
} }
h1, h1,
h2, h2,
h3, h3,
@ -55,18 +63,6 @@ h6 {
font-family: 'PT Sans Narrow', sans-serif; font-family: 'PT Sans Narrow', sans-serif;
font-weight: 700; font-weight: 700;
} }
html {
background-color: #073642;
color: #839496;
margin: 1em;
}
body {
background-color: #002b36;
margin: 0 auto;
max-width: 23cm;
border: 1pt solid #586e75;
padding: 1em;
}
code { code {
background-color: #073642; background-color: #073642;
padding: 2px; padding: 2px;
@ -94,7 +90,6 @@ pre {
background-color: #002b36; background-color: #002b36;
color: #839496; color: #839496;
border: 1pt solid #586e75; border: 1pt solid #586e75;
padding: 1em;
box-shadow: 5pt 5pt 8pt #073642; box-shadow: 5pt 5pt 8pt #073642;
} }
pre code { pre code {
@ -118,3 +113,4 @@ h5 {
h6 { h6 {
font-size: 1.15em; font-size: 1.15em;
} }

@ -3,46 +3,32 @@
<head> <head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/common/render-sd.css"></link> <link rel="stylesheet" href="/common/render-sd.css" />
<script data-main="main" src="/bower_components/requirejs/require.js"></script> <script data-main="main" src="/bower_components/requirejs/require.js"></script>
<style> <style>
html, body { html, body {
padding: 0px; padding: 0;
margin: 0px; margin: 0;
box-sizing: border-box;
}
#target {
position: fixed;
width: 100%; width: 100%;
max-width: 100%; min-height: 100%;
}
body { overflow-y: auto; }
#inner {
display: fixed;
width: 95%;
height: 100%; height: 100%;
overflow: auto;
font-size: 15px;
top: 0px; top: 0px;
left: 0px; left: 0px;
}
#inner {
margin: 15px;
}
/* don't show the textarea, it's strictly functional */
textarea {
display: none;
}
/* don't let images overflow*/
img {
max-width: 100%;
}
/* monospace for code */
code {
font-family: monospace;
}
/* bigger text size for difficult to read elements */ margin: 0px auto;
blockquote, p, pre, code, li { padding: 0px;
font-size: 20px;
} }
img { max-width: 100%; }
code { font-family: monospace; }
/* tables */ blockquote, p, pre, code, li { font-size: 20px; }
table, thead, tbody, th, tr, td{ table, thead, tbody, th, tr, td{
border: 1pt solid #586e75; border: 1pt solid #586e75;
background-color: #002b36; background-color: #002b36;
@ -54,6 +40,3 @@
<div id="target"> <div id="target">
<div id="inner"></div> <div id="inner"></div>
</div> </div>
<textarea></textarea>
</body>
</html>

@ -5,10 +5,9 @@ define([
'/bower_components/marked/marked.min.js', '/bower_components/marked/marked.min.js',
'/bower_components/hyperjson/hyperjson.js', '/bower_components/hyperjson/hyperjson.js',
'/common/cryptpad-common.js', '/common/cryptpad-common.js',
//'/common/convert.js',
'/bower_components/jquery/dist/jquery.min.js', '/bower_components/jquery/dist/jquery.min.js',
'/bower_components/diff-dom/diffDOM.js', '/bower_components/diff-dom/diffDOM.js',
'/customize/pad.js' //'/customize/pad.js'
], function (Config, Realtime, Crypto, Marked, Hyperjson, Cryptpad) { ], function (Config, Realtime, Crypto, Marked, Hyperjson, Cryptpad) {
var $ = window.jQuery; var $ = window.jQuery;
var DiffDom = window.diffDOM; var DiffDom = window.diffDOM;
@ -27,7 +26,6 @@ define([
var config = { var config = {
websocketURL: Config.websocketURL, websocketURL: Config.websocketURL,
channel: secret.channel, channel: secret.channel,
//cryptKey: secret.key,
crypto: Crypto.createEncryptor(secret.key) crypto: Crypto.createEncryptor(secret.key)
}; };
@ -49,7 +47,6 @@ define([
}; };
}()); }());
var $inner = $('#inner');
var redrawTimeout; var redrawTimeout;
var lazyDraw = function (md) { var lazyDraw = function (md) {
if (redrawTimeout) { clearTimeout(redrawTimeout); } if (redrawTimeout) { clearTimeout(redrawTimeout); }
@ -65,11 +62,23 @@ define([
module.realtime = info.realtime; module.realtime = info.realtime;
}; };
var getContent = function (userDoc) {
try {
var parsed = JSON.parse(userDoc);
if (typeof(parsed.content) !== 'string') {
throw new Error();
}
return parsed.content;
} catch (err) {
return userDoc;
}
};
// when your editor is ready // when your editor is ready
var onReady = config.onReady = function (info) { var onReady = config.onReady = function (info) {
console.log("Realtime is ready!"); console.log("Realtime is ready!");
var userDoc = module.realtime.getUserDoc(); var userDoc = module.realtime.getUserDoc();
lazyDraw(userDoc); lazyDraw(getContent(userDoc));
initializing = false; initializing = false;
}; };
@ -77,7 +86,7 @@ define([
var onRemote = config.onRemote = function () { var onRemote = config.onRemote = function () {
if (initializing) { return; } if (initializing) { return; }
var userDoc = module.realtime.getUserDoc(); var userDoc = module.realtime.getUserDoc();
lazyDraw(userDoc); lazyDraw(getContent(userDoc));
}; };
var onLocal = config.onLocal = function () { var onLocal = config.onLocal = function () {

Loading…
Cancel
Save