mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
fix: 调整cherryMarkdown toc样式 兼容打印样式
fix: 修复 convertImageToDataUri not func
This commit is contained in:
parent
acfd651be8
commit
13cc0b1e3b
@ -1961,6 +1961,15 @@ div[data-type=codeBlock] .token.inserted {
|
||||
transform: rotate(-2deg);
|
||||
}
|
||||
|
||||
.whole-article-wrap > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.whole-article-wrap > div > .markdown-article {
|
||||
width: calc(100% - 260px);
|
||||
}
|
||||
|
||||
[data-code-block-theme=coy] div[data-type=codeBlock] pre[class*=language-]:after {
|
||||
right: 0.75em;
|
||||
left: auto;
|
||||
|
@ -54950,7 +54950,7 @@
|
||||
style: ['position: absolute', 'bottom: 30px', 'top: 30px', 'left: 0', 'right: 0', 'overflow: hidden'].join(';')
|
||||
});
|
||||
this.foot = createElement('div', 'cherry-dialog--foot', {
|
||||
style: ['height: 30px', 'line-height: 30px', 'padding-left: 10px', 'padding-right: 10px', 'position: absolute', 'bottom: 0', 'left: 0', 'right: 0'].join(';')
|
||||
style: ['height: 30px', 'line-height: 18px', 'padding-left: 10px', 'padding-right: 10px', 'position: absolute', 'bottom: 0', 'left: 0', 'right: 0'].join(';')
|
||||
});
|
||||
this.headTitle = createElement('span', 'cherry-dialog--title', {
|
||||
style: 'user-select:none;'
|
||||
|
@ -5745,7 +5745,7 @@ EditorUi.prototype.convertImages = function (svgRoot, callback, imageCache, conv
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
(mxUtils.bind(this, function (img) {
|
||||
var src = converter.convert(img.getAttribute(srcAttr));
|
||||
|
||||
console.log(src)
|
||||
// Data URIs are pass-through
|
||||
if (src != null && src.substring(0, 5) != 'data:') {
|
||||
var tmp = cache[src];
|
||||
@ -6059,6 +6059,21 @@ EditorUi.prototype.getBaseFilename = function () {
|
||||
};
|
||||
|
||||
|
||||
EditorUi.prototype.convertImageToDataUri = function (src, call) {
|
||||
let img = new Image();
|
||||
img.src = src;
|
||||
img.onload = function() {
|
||||
let canvas = document.createElement('canvas');
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
let ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
let base64 = canvas.toDataURL('image/png');
|
||||
call(base64)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
EditorUi.prototype.createImageDataUri = function (canvas, xml, format) {
|
||||
var data = canvas.toDataURL('image/' + format);
|
||||
|
||||
|
@ -545,18 +545,20 @@ iframe.cherry-dialog-iframe {
|
||||
|
||||
.manual-article.cherry-markdown .toc {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
width: 200px;
|
||||
margin-top: -70px;
|
||||
right: 50px;
|
||||
width: 260px;
|
||||
font-size: 12px;
|
||||
overflow: auto;
|
||||
margin-right: 50px;
|
||||
border: 1px solid #e8e8e8;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 840px) {
|
||||
.markdown-article {
|
||||
margin-right: 200px !important;
|
||||
}
|
||||
}
|
||||
/*@media screen and (min-width: 840px) {*/
|
||||
/* .markdown-article {*/
|
||||
/* margin-right: 200px !important;*/
|
||||
/* }*/
|
||||
/*}*/
|
||||
|
||||
.markdown-article-head {
|
||||
width: unset !important;
|
||||
|
@ -141,6 +141,7 @@ function renderPage($data) {
|
||||
$("#article-info").text($data.doc_info);
|
||||
$("#view_count").text("阅读次数:" + $data.view_count);
|
||||
$("#doc_id").val($data.doc_id);
|
||||
checkMarkdownTocElement();
|
||||
if ($data.page) {
|
||||
loadComment($data.page, $data.doc_id);
|
||||
} else {
|
||||
@ -154,7 +155,7 @@ function renderPage($data) {
|
||||
$("#view_container").removeClass("theme__dark theme__green theme__light theme__red theme__default")
|
||||
$("#view_container").addClass($data.markdown_theme)
|
||||
}
|
||||
checkMarkdownTocElement();
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
@ -442,6 +443,9 @@ function loadCopySnippets() {
|
||||
|
||||
function checkMarkdownTocElement() {
|
||||
let toc = $(".markdown-toc-list");
|
||||
if ($(".toc").length) {
|
||||
toc = $(".toc");
|
||||
}
|
||||
let articleComment = $("#articleComment");
|
||||
if (toc.length) {
|
||||
$(".wiki-bottom-left").css("width", "calc(100% - 260px)");
|
||||
|
Loading…
Reference in New Issue
Block a user