Skip to content

Commit

Permalink
chore(release): 0.8.10
Browse files Browse the repository at this point in the history
Co-authored-by: sunsonliu <sunsonliu@tencent.com>
Co-authored-by: lyngai <wlxjust@gmail.com>
Co-authored-by: humyfred <513407656@qq.com>
Co-authored-by: jiawei686 <892001108@qq.com>
  • Loading branch information
4 people committed Dec 21, 2022
1 parent 488af10 commit 6de9fd2
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 26 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.8.10](https://github.com/Tencent/cherry-markdown/compare/v0.8.9...v0.8.10) (2022-12-21)


### Features

* [#370](https://github.com/Tencent/cherry-markdown/issues/370) 增加refreshPreviewer方法,可以强制重新渲染预览区域 ([c347640](https://github.com/Tencent/cherry-markdown/commit/c3476407f5dd12ae85cd0069c18b44d0c09fbe12))


### Bug Fixes

* 跨单元格的行内公式、行内代码语法改成不生效 ([178a6ac](https://github.com/Tencent/cherry-markdown/commit/178a6acddd38c17ec109a194139bba175428a64b))

### [0.8.9](https://github.com/Tencent/cherry-markdown/compare/v0.8.8...v0.8.9) (2022-11-29)


Expand Down
2 changes: 1 addition & 1 deletion dist/cherry-markdown.core.common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.engine.core.common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.engine.core.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.engine.core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.esm.js

Large diffs are not rendered by default.

94 changes: 77 additions & 17 deletions dist/cherry-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -23550,11 +23550,12 @@
* (?:^|\n)是区块的通用开头
* (\n*)捕获区块前的所有换行
* (?:[^\S\n]*)捕获```前置的空格字符
* 只要有连续3个及以上`并且前后`的数量相等,则认为是代码快语法
*/
begin: /(?:^|\n)(\n*(?:[^\S\n]*))```([^`]*?)\n/,
begin: /(?:^|\n)(\n*(?:[^\S\n]*))(`{3,})([^`]*?)\n/,
content: /([\w\W]*?)/,
// '([\\w\\W]*?)',
end: /[^\S\n]*```[ \t]*(?=$|\n+)/ // '\\s*```[ \\t]*(?=$|\\n+)',
end: /[^\S\n]*\2[ \t]*(?=$|\n+)/ // '\\s*```[ \\t]*(?=$|\\n+)',

};
codeBlock.reg = new RegExp(codeBlock.begin.source + codeBlock.content.source + codeBlock.end.source, 'g');
Expand Down Expand Up @@ -30538,7 +30539,7 @@

function ownKeys$3(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context20, _context21; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context20 = ownKeys$3(Object(source), !0)).call(_context20, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context21 = ownKeys$3(Object(source))).call(_context21, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; }
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context21, _context22; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context21 = ownKeys$3(Object(source), !0)).call(_context21, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context22 = ownKeys$3(Object(source))).call(_context22, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; }

function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

Expand Down Expand Up @@ -30576,6 +30577,8 @@

_this.indentedCodeBlock = typeof config.indentedCodeBlock === 'undefined' ? true : config.indentedCodeBlock; // 是否支持缩进代码块

_this.INLINE_CODE_REGEX = /(`+)(.+?(?:\n.+?)*?)\1/g;

if (config && config.customRenderer) {
var _context;

Expand Down Expand Up @@ -30863,7 +30866,7 @@
var $str = str; // 预处理缩进代码块

$str = this.$replaceCodeInIndent($str);
$str = $str.replace(this.RULE.reg, function (match, leadingContent, lang, code) {
$str = $str.replace(this.RULE.reg, function (match, leadingContent, begin, lang, code) {
var _leadingContent$match, _leadingContent$match2, _context19;

var $code = code;
Expand Down Expand Up @@ -30933,33 +30936,49 @@
cacheCode = cacheCode.replace(/\\/g, '\\\\');
cacheCode = _this3.$codeCache(sign, cacheCode);
return _this3.getCacheWithSpace(_this3.pushCache(cacheCode, sign, lines), match);
}); // 表格里处理行内代码,让一个td里的行内代码语法生效,让跨td的行内代码语法失效

$str = $str.replace(getTableRule(true), function (whole) {
var _context20;

return map$3(_context20 = whole.split('|')).call(_context20, function (oneTd) {
return _this3.makeInlineCode(oneTd);
}).join('|').replace(/`/g, '\\`');
}); // 为了避免InlineCode被HtmlBlock转义,需要在这里提前缓存
// InlineBlock只需要在afterMakeHtml还原即可

var INLINE_CODE_REGEX = /(`+)(.+?(?:\n.+?)*?)\1/g;
$str = this.makeInlineCode($str); // 处理缩进代码块

$str = this.$getIndentCodeBlock($str);
return $str;
}
}, {
key: "makeInlineCode",
value: function makeInlineCode(str) {
var _this4 = this;

var $str = str;

if (INLINE_CODE_REGEX.test($str)) {
if (this.INLINE_CODE_REGEX.test($str)) {
$str = $str.replace(/\\`/g, '~~not~inlineCode');
$str = $str.replace(INLINE_CODE_REGEX, function (match, syntax, code) {
$str = $str.replace(this.INLINE_CODE_REGEX, function (match, syntax, code) {
if (trim$3(code).call(code) === '`') {
return match;
}

var $code = code.replace(/~~not~inlineCode/g, '\\`');
$code = _this3.$replaceSpecialChar($code);
$code = _this4.$replaceSpecialChar($code);
$code = $code.replace(/\\/g, '\\\\');
var html = "<code>".concat(escapeHTMLSpecialChar($code), "</code>");

var sign = _this3.$engine.md5(html);
var sign = _this4.$engine.md5(html);

CodeBlock.inlineCodeCache[sign] = html;
return "~~CODE".concat(sign, "$");
});
$str = $str.replace(/~~not~inlineCode/g, '\\`');
} // 处理缩进代码块

}

$str = this.$getIndentCodeBlock($str);
return $str;
}
}, {
Expand Down Expand Up @@ -34467,19 +34486,35 @@
}, {
key: "beforeMakeHtml",
value: function beforeMakeHtml(str) {
var _context8;
var _this2 = this;

var $str = str; // 格里处理行内公式,让一个td里的行内公式语法生效,让跨td的行内公式语法失效

$str = $str.replace(getTableRule(true), function (whole) {
var _context7;

return map$3(_context7 = whole.split('|')).call(_context7, function (oneTd) {
return _this2.makeInlineMath(oneTd);
}).join('|').replace(/~D/g, '\\~D');
});
return this.makeInlineMath($str);
}
}, {
key: "makeInlineMath",
value: function makeInlineMath(str) {
var _context9;

if (!this.test(str)) {
return str;
}

if (isLookbehindSupported()) {
var _context7;
var _context8;

return str.replace(this.RULE.reg, bind$5(_context7 = this.toHtml).call(_context7, this));
return str.replace(this.RULE.reg, bind$5(_context8 = this.toHtml).call(_context8, this));
}

return replaceLookbehind(str, this.RULE.reg, bind$5(_context8 = this.toHtml).call(_context8, this), true, 1);
return replaceLookbehind(str, this.RULE.reg, bind$5(_context9 = this.toHtml).call(_context9, this), true, 1);
}
}, {
key: "makeHtml",
Expand Down Expand Up @@ -51963,6 +51998,16 @@
}
}
}
/**
* 强制重新渲染预览区域
*/

}, {
key: "refresh",
value: function refresh(html) {
var domContainer = this.getDomContainer();
domContainer.innerHTML = html;
}
}, {
key: "update",
value: function update(html) {
Expand Down Expand Up @@ -81274,7 +81319,7 @@
});
}

var VERSION = "0.8.9-7ca12b7e";
var VERSION = "0.8.10-488af100";
var CherryStatic = /*#__PURE__*/function () {
function CherryStatic() {
_classCallCheck(this, CherryStatic);
Expand Down Expand Up @@ -81706,6 +81751,21 @@
var focus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
return this.insert(content, isSelect, anchor, focus);
}
/**
* 强制重新渲染预览区域
*/

}, {
key: "refreshPreviewer",
value: function refreshPreviewer() {
try {
var markdownText = this.getValue();
var html = this.engine.makeHtml(markdownText);
this.previewer.refresh(html);
} catch (e) {
throw new NestedError(e);
}
}
/**
* 覆盖编辑区的内容
* @param {string} content markdown内容
Expand Down
2 changes: 1 addition & 1 deletion dist/cherry-markdown.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cherry-markdown.min.js

Large diffs are not rendered by default.

Binary file modified dist/fonts/ch-icon.eot
Binary file not shown.
Binary file modified dist/fonts/ch-icon.ttf
Binary file not shown.
Binary file modified dist/fonts/ch-icon.woff
Binary file not shown.
Binary file modified dist/fonts/ch-icon.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cherry-markdown",
"license": "Apache-2.0",
"version": "0.8.9",
"version": "0.8.10",
"description": "a new markdown editor",
"repository": {
"type": "git",
Expand Down

0 comments on commit 6de9fd2

Please sign in to comment.