Comparing version 1.1.0 to 1.2.0
@@ -1,16 +0,22 @@ | ||
# change log | ||
# 变更日志 | ||
---------- | ||
### [v1.2.0] - 2019-07-25 | ||
- 调整工具栏样式 | ||
- 调整视图切换模式 | ||
- 调整预览样式,限定图片最大高度,更好的同步滚动 | ||
- 优化自动保存 | ||
- 优化插入滚动条跳动的问题 | ||
### 1.1.0 2018-12-01 | ||
> - 高度设置修复 | ||
> - 调整渲染样式、默认包含 `github.css` 代码高亮样式 | ||
### [v1.1.0] - 2018-12-01 | ||
- 高度设置修复 | ||
- 调整渲染样式、默认包含 `github.css` 代码高亮样式 | ||
### 1.0.1 2018-06-13 | ||
> - 滚动条同步方法改进 | ||
> - 调整渲染样式 | ||
> - 新增变化本地保存 | ||
> - 隐藏工具条后高度设置修复 | ||
### [v1.0.1] - 2018-06-13 | ||
- 滚动条同步方法改进 | ||
- 调整渲染样式 | ||
- 新增变化本地保存 | ||
- 隐藏工具条后高度设置修复 | ||
### 1.0.2 2018-07-06 | ||
> - clear方法追加清空本地缓存 | ||
### [v1.0.2] - 2018-07-06 | ||
- clear方法追加清空本地缓存 |
{ | ||
"name": "netnrmd", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Markdown Combinatorial editor | 组合编辑器", | ||
"main": "src/netnrmd.min.js", | ||
"main": "src/netnrmd.js", | ||
"scripts": { | ||
@@ -22,5 +22,5 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"homepage": "https://github.com/netnr/netnrmd#readme", | ||
"files":[ | ||
"files": [ | ||
"src" | ||
] | ||
} |
@@ -52,6 +52,4 @@ # netnrmd | ||
var nmd = new netnrmd('#txt', { | ||
//全屏 | ||
fullscreen: false, | ||
//分屏 | ||
splitscreen: true, | ||
//视图,1输入,2分屏,3预览,默认2 | ||
viewmodel: 2 | ||
@@ -65,4 +63,4 @@ //高度 | ||
storekey: "key", | ||
//有变化自动保存(秒),默认0不保存 | ||
storetime: 3, | ||
//默认有变化自动保存 | ||
autosave: true, | ||
@@ -159,17 +157,11 @@ //矢量图标前缀,font-awesome | ||
//toggle Full Screen 切换全屏 | ||
nmd.toggleFullScreen(); | ||
nmd.toggleFullScreen(true); | ||
nmd.toggleFullScreen(false); | ||
//toggle View 视图切换,默认2、1、3循环 | ||
nmd.toggleView(); | ||
//输入 | ||
nmd.toggleView(1); | ||
//分屏 | ||
nmd.toggleView(2); | ||
//预览 | ||
nmd.toggleView(3); | ||
//toggle Split Screen 切换分屏 | ||
nmd.toggleSplitScreen(); | ||
nmd.toggleSplitScreen(true); | ||
nmd.toggleSplitScreen(false); | ||
//toggle Preview 预览切换 | ||
nmd.togglePreview(); | ||
nmd.togglePreview(true); | ||
nmd.togglePreview(false); | ||
//set markdown 赋值 | ||
@@ -176,0 +168,0 @@ nmd.setmd(md); |
/* *\ | ||
* netnrmd v1.1.0 | ||
* netnrmd v1.2.0 | ||
* markdown语法解析基于remarkable,编辑与解析分离 | ||
@@ -9,3 +9,3 @@ * 调用任意markdown解析器都能完美的运行 | ||
* Gitee:https://gitee.com/netnr/netnrmd | ||
* Date:2018-12-01 | ||
* Date:2019-07-25 | ||
* | ||
@@ -117,7 +117,2 @@ * Author:netnr | ||
float: 'right' | ||
}, { | ||
title: '预览/preview', | ||
icon: 'eye', | ||
cmd: 'preview', | ||
float: 'right' | ||
} | ||
@@ -132,2 +127,8 @@ ]); | ||
} | ||
//自动保存 | ||
if (obj.autosave) { | ||
that.setstore(); | ||
} | ||
that.render(); | ||
@@ -189,6 +190,4 @@ }).keydown(function (e) { | ||
}); | ||
//分屏 | ||
this.toggleSplitScreen(obj.splitscreen = netnrmd.dv(obj.splitscreen, true)); | ||
//预览 | ||
this.togglePreview(obj.preview = netnrmd.dv(obj.preview, false)); | ||
//视图模式:1输入|2分屏|3预览 | ||
obj.viewmodel = netnrmd.dv(obj.viewmodel, 2); | ||
//高度 | ||
@@ -198,18 +197,8 @@ this.height(obj.height = netnrmd.dv(obj.height, 250)); | ||
obj.storekey = netnrmd.dv(obj.storekey, "netnrmd_markdown"); | ||
//本地保存时间,单位:秒 | ||
obj.storetime = netnrmd.dv(obj.storetime, 0); | ||
//本地自动保存 | ||
obj.autosave = netnrmd.dv(obj.autosave, true); | ||
//载入本地保存 | ||
if (obj.storetime > 0) { | ||
if (obj.autosave > 0) { | ||
this.getstore(); | ||
} | ||
//本地保存任务 | ||
setInterval(function () { | ||
if (obj.storetime > 0) { | ||
var preval = obj.textarea[0]["preval"] || ""; | ||
if (preval != obj.textarea.val()) { | ||
obj.textarea[0]["preval"] = obj.textarea.val(); | ||
that.setstore(); | ||
} | ||
} | ||
}, obj.storetime > 0 ? 1000 * obj.storetime : 1000); | ||
@@ -258,3 +247,3 @@ obj.textarea.data('netnrmd', this); | ||
toggleSplitScreen: function (splitscreen) { | ||
var obj = this.obj, tit = this.getToolItemTarget('split'); | ||
var obj = this.obj; | ||
obj.splitscreen = !obj.splitscreen; | ||
@@ -269,7 +258,5 @@ if (splitscreen != null) { | ||
obj.view.addClass('netnrmd-view-hidden'); | ||
$(tit).removeClass('active'); | ||
} else { | ||
obj.write.removeClass('netnrmd-write-w100'); | ||
obj.view.removeClass('netnrmd-view-hidden'); | ||
$(tit).addClass('active'); | ||
} | ||
@@ -279,3 +266,3 @@ }, | ||
togglePreview: function (preview) { | ||
var obj = this.obj, tit = this.getToolItemTarget('preview'); | ||
var obj = this.obj; | ||
obj.preview = !obj.preview; | ||
@@ -289,9 +276,31 @@ if (preview != null) { | ||
obj.view.addClass('netnrmd-view-w100'); | ||
$(tit).addClass('active'); | ||
} else { | ||
obj.write.removeClass('netnrmd-write-hidden'); | ||
obj.view.removeClass('netnrmd-view-w100'); | ||
$(tit).removeClass('active'); | ||
} | ||
}, | ||
//视图切换 | ||
toggleView: function (n) { | ||
if (n == null) { | ||
n = this.obj.viewmodel - 1; | ||
if (n < 1) { | ||
n = 3; | ||
} | ||
} | ||
this.obj.viewmodel = n; | ||
switch (n) { | ||
case 1: | ||
this.togglePreview(0); | ||
this.toggleSplitScreen(0); | ||
break; | ||
case 2: | ||
this.togglePreview(0); | ||
this.toggleSplitScreen(1); | ||
break; | ||
case 3: | ||
this.toggleSplitScreen(0); | ||
this.togglePreview(1); | ||
break; | ||
} | ||
}, | ||
//根据命令获取工具条的对象 | ||
@@ -386,3 +395,3 @@ getToolItemTarget: function (cmd) { | ||
//版本 | ||
netnrmd.version = "1.1.0"; | ||
netnrmd.version = "1.2.0"; | ||
@@ -410,3 +419,4 @@ //命令 | ||
defaultvalue: '', | ||
after: '' | ||
after: '', | ||
isdo: true | ||
} | ||
@@ -487,15 +497,15 @@ switch (cmdname) { | ||
case "help": | ||
ops.isdo = false; | ||
window.open('https://netnr.gitee.io/markdownguide/', '_blank'); | ||
break; | ||
case "full": | ||
ops.isdo = false; | ||
$(txt).data('netnrmd').toggleFullScreen(); | ||
break; | ||
case "preview": | ||
$(txt).data('netnrmd').togglePreview(); | ||
break; | ||
case "split": | ||
$(txt).data('netnrmd').toggleSplitScreen(); | ||
ops.isdo = false; | ||
$(txt).data('netnrmd').toggleView(); | ||
break; | ||
} | ||
netnrmd.insertxt(ops); | ||
ops.isdo && netnrmd.insertxt(ops); | ||
}; | ||
@@ -610,5 +620,10 @@ | ||
} | ||
var htop = document.documentElement.scrollTop; | ||
netnrmd.insertAfterText(txt, before + text + after); | ||
netnrmd.setSelectText(txt, pos, pos + text.length); | ||
document.documentElement.scrollTop = htop; | ||
//编辑器内容变动回调 | ||
@@ -615,0 +630,0 @@ var that = $(txt).data('netnrmd'), obj = that.obj; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1429
143683
7
241