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

[WIP] 新增 chart.js、mermaid、emoji 支持 #775

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ gulp.task('plugins', function() {
gulp.task('concatMarkdownJs', function() {
var jss = [
'js/require.js',
'md/main.min.js',
'md/main.js',
];

for(var i in jss) {
Expand All @@ -114,7 +114,7 @@ gulp.task('concatMarkdownJs', function() {
gulp.task('concatMarkdownJsV2', function() {
var jss = [
'js/require.js',
'md/main-v2.min.js',
'md/main-v2.js',
];

for(var i in jss) {
Expand Down Expand Up @@ -276,13 +276,13 @@ gulp.task('i18n', function() {

// 写入到文件中
var toFilename = targetFilename + '.' + lang + '.js';
fs.writeFile(base + '/js/i18n/' + toFilename, str);
fs.writeFileSync(base + '/js/i18n/' + toFilename, str, function (err) { });
}

function genTinymceLang(lang) {
var msgs = getAllMsgs(leanoteBase + 'messages/' + lang + '/tinymce_editor.conf');
var str = 'tinymce.addI18n("' + lang + '",' + JSON.stringify(msgs) + ');';
fs.writeFile(base + '/tinymce/langs/' + lang + '.js', str);
fs.writeFileSync(base + '/tinymce/langs/' + lang + '.js', str);
}

var langs = getAllLangs();
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/member/MemberBlogController.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (c MemberBlog) UpdateTheme(themeId string, isNew int) revel.Result {
}

c.common()
c.ViewArgs["title"] = c.Message("Update Theme")
c.ViewArgs["title"] = c.Message("updateTheme")
c.ViewArgs["isNew"] = isNew

// 先复制之
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h4 class="font-thin padder">
<script>
$(function() {
// leanote动态
var url = "http://leanote.com/blog/listCateLatest/5446753cfacfaa4f56000000";
var url = "https://leanote.com/blog/listCateLatest/5446753cfacfaa4f56000000";
function renderItem(item) {
return '<li class="list-group-item"><p><a target="_blank" href="http://leanote.com/blog/view/' + item.NoteId + '">' + item.Title + '</a></p><small class="block text-muted"><i class="fa fa-clock-o"></i> ' + goNowToDatetime(item.PublicTime) + '</small></li>';
}
Expand Down
5 changes: 4 additions & 1 deletion app/views/note/note-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<link href="/public/md/themes/default.css" rel="stylesheet" />
<!-- context-menu -->
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu-min.css?id=1" type="text/css" />
<!-- emoji https://afeld.github.io/emoji-css/emoji.css -->
<link href="/public/css/emoji.css" rel="stylesheet">

<script>
var hash = location.hash;
Expand Down Expand Up @@ -913,6 +915,7 @@ <h4 class="modal-title" class="modalTitle">{{msg . "theme"}}</h4>
<!-- /dev -->

<!-- pro_app_js -->
<script src="https://cdn.bootcss.com/mermaid/7.1.2/mermaid.js"></script>
<script>
initPage();
// 当tinymce.dev.js时, 请注释require
Expand All @@ -925,7 +928,7 @@ <h4 class="modal-title" class="modalTitle">{{msg . "theme"}}</h4>

<!-- dev -->
<script src="/js/require.js"></script>
<script src="/public/md/main-v2.min.js"></script>
<script src="/public/md/main-v2.js"></script>
<!-- /dev -->

<script src="/public/js/plugins/main.js"></script>
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
"version": "1.0.0",
"private": true,
"devDependencies": {
"gulp": "^3.8.7",
"gulp-uglify": "^1.0.0",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.1",
"gulp-util": "^3.0.1",
"gulp-rename": "^1.0",
"gulp-minify-html": "^1.0",
"gulp-concat": "",
"gulp-replace": "",
"gulp-inject": "",
"gulp-sequence": ""
"gulp-minify-html": "^1.0",
"gulp-rename": "^1.0",
"gulp-replace": "",
"gulp-sequence": "",
"gulp-uglify": "^1.0.0",
"gulp-util": "^3.0.1"
},
"author": "life(http://life.leanote.com)",
"license": "GPL v2",
"bugs": {
"url": "https://github.com/leanote/leanote/issues"
},
"dependencies": {
"gulp-minify-css": "^1.2.4"
}
}
2 changes: 1 addition & 1 deletion public/blog/themes/default/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ <h1>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
</div>
3 changes: 3 additions & 0 deletions public/blog/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,6 @@ table tr:nth-child(2n) {
word-wrap: break-word;
}

code {
white-space: normal;
}
40 changes: 40 additions & 0 deletions public/css/block-container.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.success,
.info,
.warning,
.danger {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}

.success>p:last-child,
.info>p:last-child,
.warning>p:last-child,
.danger>p:last-child {
margin-bottom: 0;
}

.success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}

.info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}

.warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}

.danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
1 change: 1 addition & 0 deletions public/css/emoji.css

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions public/js/app/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ Note.genAbstract = function(content, len) {
}
var isCode = false;
var isHTML = false;
var isMermaid = false;
var n = 0;
var result = "";
var maxLen = len;
Expand All @@ -363,7 +364,7 @@ Note.genAbstract = function(content, len) {
} else if (temp == ';' && isHTML) {
isHTML = false
}
if (!isCode && !isHTML) {
if (!isCode && !isHTML && !isMermaid) {
n = n + 1
}
result += temp
Expand Down Expand Up @@ -1716,6 +1717,7 @@ Note.toggleReadOnly = function(needSave) {
return Note.toggleWriteable();
}

$('#left-column').hide();
var me = this;
var note = me.getCurNote();

Expand Down Expand Up @@ -1770,7 +1772,7 @@ LEA.toggleWriteable = Note.toggleWriteable = function(isFromNewNote) {

// markdown
$('#mdEditor').removeClass('read-only');

$('#left-column').show();
var note = me.getCurNote();
if(!note) {
return;
Expand Down