Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heading support #532

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 22 additions & 27 deletions node/utils/ExportHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ function getHTMLFromAtext(pad, atext)
var textLines = atext.text.slice(0, -1).split('\n');
var attribLines = Changeset.splitAttributionLines(atext.attribs, atext.text);

var tags = ['h1', 'h2', 'strong', 'em', 'u', 's'];
var props = ['heading1', 'heading2', 'bold', 'italic', 'underline', 'strikethrough'];
var tags = ['h1', 'h2', 'h3', 'h4', 'strong', 'em', 'u', 's'];
var props = ['bold', 'italic', 'underline', 'strikethrough'];
var anumMap = {};

props.forEach(function (propName, i)
Expand Down Expand Up @@ -341,36 +341,15 @@ function getHTMLFromAtext(pad, atext)
{
pieces.push('<ol class="'+line.listTypeName+'"><li>', lineContent || '<br>');
}
else
else if(line.listTypeName == "title")
{
pieces.push('<ul class="'+line.listTypeName+'"><li>', lineContent || '<br>');
}
}
//the following code *seems* dead after my patch.
//I keep it just in case I'm wrong...
/*else if (whichList == -1)//means we are not inside a list
{
if (line.text)
{
console.log('trace 1');
// non-blank line, end all lists
if(line.listTypeName == "number")
{
pieces.push(new Array(lists.length + 1).join('</li></ol>'));
}
else
{
pieces.push(new Array(lists.length + 1).join('</li></ul>'));
}
lists.length = 0;
pieces.push(lineContent, '<br>');
pieces.push('<h'+line.listLevel+'>', lineContent || '', '</h'+line.listLevel+'>');
}
else
{
console.log('trace 2');
pieces.push('<br><br>');
pieces.push('<ul class="'+line.listTypeName+'"><li>', lineContent || '<br>');
}
}*/
}
else//means we are getting closer to the lowest level of indentation
{
while (whichList < lists.length - 1)
Expand All @@ -379,6 +358,10 @@ function getHTMLFromAtext(pad, atext)
{
pieces.push('</li></ol>');
}
else if(line.listTypeName == "title")
{
//do nothing
}
else
{
pieces.push('</li></ul>');
Expand All @@ -396,6 +379,10 @@ function getHTMLFromAtext(pad, atext)
{
pieces.push('</li></ol>');
}
else if(line.listTypeName == "title")
{
//do nothing
}
else
{
pieces.push('</li></ul>');
Expand All @@ -412,6 +399,10 @@ function getHTMLFromAtext(pad, atext)
{
pieces.push('</li></ol>');
}
else if(line.listTypeName == "title")
{
//do nothing
}
else
{
pieces.push('</li></ul>');
Expand Down Expand Up @@ -482,6 +473,10 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback)
'ol ol ol ol ol ol{ list-style-type: lower-roman; }' +
'ol ol ol ol ol ol ol { list-style-type: decimal; }' +
'ol ol ol ol ol ol ol ol{ list-style-type: lower-latin; }' +
'h1{font-size: 30px;line-height: 35px;}' +
'h2{font-size: 25px;line-height: 30px;}' +
'h3{font-size: 20px;line-height: 25px;}' +
'h4{font-size: 15px;line-height: 20px;}' +
'</style>\n' + '</head>\n') +
'<body>';

Expand Down
20 changes: 20 additions & 0 deletions static/css/iframe_editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ body.doesWrap {
padding-right: 1px;
}

h1{
font-size: 30px;
line-height: 36px;
}

h2{
font-size: 25px;
line-height: 31px;
}

h3{
font-size: 20px;
line-height: 25px;
}

h4{
font-size: 15px;
line-height: 20px;
}

p {
margin: 0;
}
Expand Down
98 changes: 73 additions & 25 deletions static/css/pad.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,71 +46,119 @@ a img
width: 100%;
}

#editbar ul
{
float: left;
}

#editbar ul li
{
cursor: pointer;
float: left;
margin-left: 2px;
overflow: hidden;
}

#editbar ul li.button
{
background: #fff;
background: linear-gradient(#fff, #f0f0f0);
border: 1px solid #ccc;
border-radius: 4px;
cursor: pointer;
float: left;
width: 18px;
height: 18px;
margin-left: 2px;
overflow: hidden;
padding: 4px 5px;
width: 18px;
}

#editbar ul li:hover {
background: #fff;
background: linear-gradient(#f4f4f4, #e4e4e4);
}

#editbar ul li:active {
background: #eee;
background: linear-gradient(#ddd, #fff);
box-shadow: 0 0 8px rgba(0,0,0,.1) inset;
}

#editbar ul li a
{
display: block;
text-decoration: none;
color: #ccc;
position: absolute;
}

#editbar ul li a img
{
padding: 1px;
}

#editbar ul li a span
{
position: relative;
top:-2px
}

#editbar ul li:hover {
background: #fff;
background: linear-gradient(#f4f4f4, #e4e4e4);
}

#editbar ul li:active {
background: #eee;
background: linear-gradient(#ddd, #fff);
box-shadow: 0 0 8px rgba(0,0,0,.1) inset;
}

#editbar ul li.separator
{
border: inherit;
background: inherit;
visibility:hidden;
width: 0px;
padding: 4px 5px;
}
#editbar ul li a
{
display: block;

#editbar ul select{
background: #fff;
background: linear-gradient(#fff, #f0f0f0);
border: 1px solid #ccc;
border-radius: 4px;
text-align: center;
padding: 4px;
margin: 0;
height: 28px;
width: 120px;
}
#editbar ul li a img
{
padding: 1px;

#editbar ul select:hover {
background: #fff;
background: linear-gradient(#f4f4f4, #e4e4e4);
}

#editbar ul select option{
text-align: left;
}

#editbar ul
{
float: left;
#editbar ul select .dummy {
text-align: center;
}

#editbar ul#menu_right
{
float: right;
}

.list-title1{
font-size: 30px;
line-height: 36px;
}

.list-title2{
font-size: 25px;
line-height: 31px;
}

.list-title3{
font-size: 20px;
line-height: 25px;
}

.list-title4{
font-size: 15px;
line-height: 20px;
}

#users
{
display: none;
Expand Down
Loading