Vanessa 2023-03-02 15:18:37 +08:00
parent 35081c1e9b
commit e2a18447bd
11 changed files with 88 additions and 24 deletions

View file

@ -1,5 +1,14 @@
document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg"> document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs> <defs>
<symbol id="iconDatabase" viewBox="0 0 32 32">
<path d="M16 14.278q-6.932 0-11.216-2.11t-4.284-4.779q0-2.712 4.284-4.801t11.216-2.088 11.216 2.088 4.284 4.801q0 2.669-4.284 4.779t-11.216 2.11zM16 22.889q-6.286 0-10.893-1.894t-4.607-4.564v-4.306q0 1.679 1.615 2.906t4.004 2.024 5.081 1.163 4.801 0.366q2.153 0 4.822-0.366t5.059-1.141 4.004-2.002 1.615-2.949v4.306q0 2.669-4.607 4.564t-10.893 1.894zM16 31.5q-6.286 0-10.893-1.894t-4.607-4.564v-4.306q0 1.679 1.615 2.906t4.004 2.024 5.081 1.163 4.801 0.366q2.153 0 4.822-0.366t5.059-1.141 4.004-2.002 1.615-2.949v4.306q0 2.669-4.607 4.564t-10.893 1.894z"></path>
</symbol>
<symbol id="iconKeyboardHide" viewBox="0 0 32 32">
<path d="M16 31.5l-5.696-5.735h11.431l-5.735 5.735zM2.825 22.2q-0.93 0-1.627-0.698t-0.698-1.628v-17.050q0-0.93 0.698-1.627t1.627-0.698h26.35q0.93 0 1.628 0.698t0.698 1.627v17.050q0 0.93-0.698 1.628t-1.628 0.698h-26.35zM2.825 19.875h26.35v-17.050h-26.35v17.050zM9.955 17.356h12.129v-2.325h-12.129v2.325zM5.034 12.512h2.325v-2.325h-2.325v2.325zM9.955 12.512h2.325v-2.325h-2.325v2.325zM14.838 12.512h2.325v-2.325h-2.325v2.325zM19.759 12.512h2.325v-2.325h-2.325v2.325zM24.641 12.512h2.325v-2.325h-2.325v2.325zM5.034 7.669h2.325v-2.325h-2.325v2.325zM9.955 7.669h2.325v-2.325h-2.325v2.325zM14.838 7.669h2.325v-2.325h-2.325v2.325zM19.759 7.669h2.325v-2.325h-2.325v2.325zM24.641 7.669h2.325v-2.325h-2.325v2.325zM2.825 19.875v0z"></path>
</symbol>
<symbol id="iconBIU" viewBox="0 0 32 32">
<path d="M1.2 22.167v-12.333h5.021c0.969 0 1.81 0.308 2.522 0.925s1.068 1.395 1.068 2.335c0 0.558-0.154 1.072-0.463 1.542s-0.719 0.83-1.233 1.079v0.132c0.631 0.206 1.142 0.573 1.531 1.101s0.584 1.123 0.584 1.784c0 0.998-0.385 1.821-1.156 2.467s-1.67 0.969-2.698 0.969zM3.094 20.493h3.171c0.558 0 1.042-0.184 1.454-0.551s0.617-0.83 0.617-1.387c0-0.543-0.206-0.998-0.617-1.366s-0.896-0.551-1.454-0.551h-3.171zM3.094 15.053h2.995c0.514 0 0.958-0.169 1.332-0.507s0.562-0.764 0.562-1.277c0-0.514-0.187-0.943-0.562-1.288s-0.819-0.518-1.332-0.518h-2.995zM10.23 22.167v-1.734h2.905l3.013-8.865h-3.446v-1.734h8.237v1.734h-2.904l-3.013 8.865h3.446v1.734zM20.933 22.167v-1.057h9.867v1.057zM25.867 19.7c-1.175 0-2.094-0.344-2.757-1.031s-0.995-1.618-0.995-2.793v-6.043h1.462v6.043c0 0.74 0.2 1.333 0.599 1.779s0.963 0.669 1.691 0.669c0.728 0 1.292-0.223 1.691-0.669s0.599-1.040 0.599-1.78v-6.043h1.462v6.043c0 1.175-0.332 2.106-0.995 2.793s-1.583 1.031-2.757 1.031z"></path>
</symbol>
<symbol id="iconCloud" viewBox="0 0 32 32"> <symbol id="iconCloud" viewBox="0 0 32 32">
<path d="M25.8 13.387c-0.907-4.6-4.947-8.053-9.8-8.053-3.853 0-7.187 2.187-8.853 5.387-4.013 0.427-7.147 3.813-7.147 7.947 0 4.413 3.587 8 8 8h17.333c3.68 0 6.667-2.987 6.667-6.667 0-3.52-2.733-6.373-6.2-6.613zM25.333 24h-17.333c-2.947 0-5.333-2.387-5.333-5.333s2.387-5.333 5.333-5.333 5.333 2.387 5.333 5.333h2.667c0-3.68-2.48-6.773-5.867-7.707 1.347-1.787 3.467-2.96 5.867-2.96 4.040 0 7.333 3.293 7.333 7.333v0.667h2c2.2 0 4 1.8 4 4s-1.8 4-4 4z"></path> <path d="M25.8 13.387c-0.907-4.6-4.947-8.053-9.8-8.053-3.853 0-7.187 2.187-8.853 5.387-4.013 0.427-7.147 3.813-7.147 7.947 0 4.413 3.587 8 8 8h17.333c3.68 0 6.667-2.987 6.667-6.667 0-3.52-2.733-6.373-6.2-6.613zM25.333 24h-17.333c-2.947 0-5.333-2.387-5.333-5.333s2.387-5.333 5.333-5.333 5.333 2.387 5.333 5.333h2.667c0-3.68-2.48-6.773-5.867-7.707 1.347-1.787 3.467-2.96 5.867-2.96 4.040 0 7.333 3.293 7.333 7.333v0.667h2c2.2 0 4 1.8 4 4s-1.8 4-4 4z"></path>
</symbol> </symbol>

View file

@ -28,6 +28,24 @@
<body> <body>
<h2>SiYuan</h2> <h2>SiYuan</h2>
<div class="fn__clear"> <div class="fn__clear">
<div>
<svg>
<use xlink:href="#iconDatabase"></use>
</svg>
iconDatabase
</div>
<div>
<svg>
<use xlink:href="#iconBIU"></use>
</svg>
iconBIU
</div>
<div>
<svg>
<use xlink:href="#iconKeyboardHide"></use>
</svg>
iconKeyboardHide
</div>
<div> <div>
<svg> <svg>
<use xlink:href="#iconWorkspace"></use> <use xlink:href="#iconWorkspace"></use>

View file

@ -1,5 +1,14 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg"> document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs> <defs>
<symbol id="iconDatabase" viewBox="0 0 32 32">
<path d="M16 14.278q-6.932 0-11.216-2.11t-4.284-4.779q0-2.712 4.284-4.801t11.216-2.088 11.216 2.088 4.284 4.801q0 2.669-4.284 4.779t-11.216 2.11zM16 22.889q-6.286 0-10.893-1.894t-4.607-4.564v-4.306q0 1.679 1.615 2.906t4.004 2.024 5.081 1.163 4.801 0.366q2.153 0 4.822-0.366t5.059-1.141 4.004-2.002 1.615-2.949v4.306q0 2.669-4.607 4.564t-10.893 1.894zM16 31.5q-6.286 0-10.893-1.894t-4.607-4.564v-4.306q0 1.679 1.615 2.906t4.004 2.024 5.081 1.163 4.801 0.366q2.153 0 4.822-0.366t5.059-1.141 4.004-2.002 1.615-2.949v4.306q0 2.669-4.607 4.564t-10.893 1.894z"></path>
</symbol>
<symbol id="iconKeyboardHide" viewBox="0 0 32 32">
<path d="M16 31.5l-5.696-5.735h11.431l-5.735 5.735zM2.825 22.2q-0.93 0-1.627-0.698t-0.698-1.628v-17.050q0-0.93 0.698-1.627t1.627-0.698h26.35q0.93 0 1.628 0.698t0.698 1.627v17.050q0 0.93-0.698 1.628t-1.628 0.698h-26.35zM2.825 19.875h26.35v-17.050h-26.35v17.050zM9.955 17.356h12.129v-2.325h-12.129v2.325zM5.034 12.512h2.325v-2.325h-2.325v2.325zM9.955 12.512h2.325v-2.325h-2.325v2.325zM14.838 12.512h2.325v-2.325h-2.325v2.325zM19.759 12.512h2.325v-2.325h-2.325v2.325zM24.641 12.512h2.325v-2.325h-2.325v2.325zM5.034 7.669h2.325v-2.325h-2.325v2.325zM9.955 7.669h2.325v-2.325h-2.325v2.325zM14.838 7.669h2.325v-2.325h-2.325v2.325zM19.759 7.669h2.325v-2.325h-2.325v2.325zM24.641 7.669h2.325v-2.325h-2.325v2.325zM2.825 19.875v0z"></path>
</symbol>
<symbol id="iconBIU" viewBox="0 0 32 32">
<path d="M1.2 22.167v-12.333h5.021c0.969 0 1.81 0.308 2.522 0.925s1.068 1.395 1.068 2.335c0 0.558-0.154 1.072-0.463 1.542s-0.719 0.83-1.233 1.079v0.132c0.631 0.206 1.142 0.573 1.531 1.101s0.584 1.123 0.584 1.784c0 0.998-0.385 1.821-1.156 2.467s-1.67 0.969-2.698 0.969zM3.094 20.493h3.171c0.558 0 1.042-0.184 1.454-0.551s0.617-0.83 0.617-1.387c0-0.543-0.206-0.998-0.617-1.366s-0.896-0.551-1.454-0.551h-3.171zM3.094 15.053h2.995c0.514 0 0.958-0.169 1.332-0.507s0.562-0.764 0.562-1.277c0-0.514-0.187-0.943-0.562-1.288s-0.819-0.518-1.332-0.518h-2.995zM10.23 22.167v-1.734h2.905l3.013-8.865h-3.446v-1.734h8.237v1.734h-2.904l-3.013 8.865h3.446v1.734zM20.933 22.167v-1.057h9.867v1.057zM25.867 19.7c-1.175 0-2.094-0.344-2.757-1.031s-0.995-1.618-0.995-2.793v-6.043h1.462v6.043c0 0.74 0.2 1.333 0.599 1.779s0.963 0.669 1.691 0.669c0.728 0 1.292-0.223 1.691-0.669s0.599-1.040 0.599-1.78v-6.043h1.462v6.043c0 1.175-0.332 2.106-0.995 2.793s-1.583 1.031-2.757 1.031z"></path>
</symbol>
<symbol id="iconCloud" viewBox="0 0 32 32"> <symbol id="iconCloud" viewBox="0 0 32 32">
<path d="M25.8 13.387c-0.907-4.6-4.947-8.053-9.8-8.053-3.853 0-7.187 2.187-8.853 5.387-4.013 0.427-7.147 3.813-7.147 7.947 0 4.413 3.587 8 8 8h17.333c3.68 0 6.667-2.987 6.667-6.667 0-3.52-2.733-6.373-6.2-6.613zM25.333 24h-17.333c-2.947 0-5.333-2.387-5.333-5.333s2.387-5.333 5.333-5.333 5.333 2.387 5.333 5.333h2.667c0-3.68-2.48-6.773-5.867-7.707 1.347-1.787 3.467-2.96 5.867-2.96 4.040 0 7.333 3.293 7.333 7.333v0.667h2c2.2 0 4 1.8 4 4s-1.8 4-4 4z"></path> <path d="M25.8 13.387c-0.907-4.6-4.947-8.053-9.8-8.053-3.853 0-7.187 2.187-8.853 5.387-4.013 0.427-7.147 3.813-7.147 7.947 0 4.413 3.587 8 8 8h17.333c3.68 0 6.667-2.987 6.667-6.667 0-3.52-2.733-6.373-6.2-6.613zM25.333 24h-17.333c-2.947 0-5.333-2.387-5.333-5.333s2.387-5.333 5.333-5.333 5.333 2.387 5.333 5.333h2.667c0-3.68-2.48-6.773-5.867-7.707 1.347-1.787 3.467-2.96 5.867-2.96 4.040 0 7.333 3.293 7.333 7.333v0.667h2c2.2 0 4 1.8 4 4s-1.8 4-4 4z"></path>
</symbol> </symbol>

View file

@ -245,9 +245,10 @@
&__split { &__split {
width: 1px; width: 1px;
height: 70%; height: 28px;
background: var(--b3-border-color); background: var(--b3-border-color);
align-self: center; align-self: center;
flex-shrink: 0;
} }
button { button {
@ -258,8 +259,15 @@
svg { svg {
height: 16px; height: 16px;
width: 16px; width: 16px;
float: left;
padding: 12px; padding: 12px;
color: var(--b3-theme-on-surface); color: var(--b3-theme-on-surface);
&.keyboard__svg--big {
width: 30px;
padding: 4px;
height: 32px;
}
} }
} }
} }

View file

@ -15,7 +15,7 @@ import {promiseTransactions} from "../protyle/wysiwyg/transaction";
import {bootSync} from "../dialog/processSystem"; import {bootSync} from "../dialog/processSystem";
import {initMessage} from "../dialog/message"; import {initMessage} from "../dialog/message";
import {goBack} from "./util/MobileBackFoward"; import {goBack} from "./util/MobileBackFoward";
import {hideKeyboardToolbar, showKeyboardToolbar} from "./util/showKeyboardToolbar"; import {hideKeyboardToolbar, showKeyboardToolbar} from "./util/keyboardToolbar";
import {getLocalStorage} from "../protyle/util/compatibility"; import {getLocalStorage} from "../protyle/util/compatibility";
import {openMobileFileById} from "./editor"; import {openMobileFileById} from "./editor";
import {getSearch} from "../util/functions"; import {getSearch} from "../util/functions";

View file

@ -17,7 +17,7 @@ import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
import {MobileBacklinks} from "./MobileBacklinks"; import {MobileBacklinks} from "./MobileBacklinks";
import {MobileBookmarks} from "./MobileBookmarks"; import {MobileBookmarks} from "./MobileBookmarks";
import {MobileTags} from "./MobileTags"; import {MobileTags} from "./MobileTags";
import {hideKeyboard, hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar"; import {hideKeyboard, hideKeyboardToolbar, initKeyboardToolbar} from "./keyboardToolbar";
import {getSearch} from "../../util/functions"; import {getSearch} from "../../util/functions";
import {syncGuide} from "../../sync/syncGuide"; import {syncGuide} from "../../sync/syncGuide";

View file

@ -37,24 +37,45 @@ export const showKeyboardToolbar = (bottom = 0) => {
export const renderKeyboardToolbar = (protyle: IProtyle, range: Range) => { export const renderKeyboardToolbar = (protyle: IProtyle, range: Range) => {
const toolbarElement = document.getElementById("keyboardToolbar"); const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.innerHTML = `<div class="keyboard__dynamic"> const inlineHTML = `<button data-type="indent"><svg><use xlink:href="#iconBack"></use></svg></button>
<button data-type="indent"><svg><use xlink:href="#iconIndent"></use></svg></button> <button data-type="indent"><svg><use xlink:href="#iconRef"></use></svg></button>
<button data-type="outdent"><svg><use xlink:href="#iconOutdent"></use></svg></button> <button data-type="block-ref"<use xlink:href="#iconRef"></use></svg></button>
<button data-type="a"><svg><use xlink:href="#iconLink"></use></svg></button>
<button data-type="up"><svg><use xlink:href="#iconUp"></use></svg></button> <button data-type="text"><svg><use xlink:href="#iconFont"></use></svg></button>
<button data-type="down"><svg><use xlink:href="#iconDown"></use></svg></button> <button data-type="strong"><svg><use xlink:href="#iconBold"></use></svg></button>
<button data-type="em"><svg><use xlink:href="#iconItalic"></use></svg></button>
<button data-type="before"><svg><use xlink:href="#iconBefore"></use></svg></button> <button data-type="u"><svg><use xlink:href="#iconUnderline"></use></svg></button>
<button data-type="after"><svg><use xlink:href="#iconAfter"></use></svg></button> <button data-type="s"><svg><use xlink:href="#iconStrike"></use></svg></button>
<button data-type="mark"><svg><use xlink:href="#iconMark"></use></svg></button>
<button data-type="sup"><svg><use xlink:href="#iconSup"></use></svg></button>
<button data-type="sub"><svg><use xlink:href="#iconSub"></use></svg></button>
<button data-type="clear"><svg><use xlink:href="#iconClear"></use></svg></button> <button data-type="clear"><svg><use xlink:href="#iconClear"></use></svg></button>
<button data-type="code"><svg><use xlink:href="#iconInlineCode"></use></svg></button>
<button data-type="kbd"<use xlink:href="#iconKeymap"></use></svg></button>
<button data-type="tag"><svg><use xlink:href="#iconTags"></use></svg></button>
<button data-type="inline-math"><svg><use xlink:href="#iconMath"></use></svg></button>
<button data-type="inline-memo"><svg><use xlink:href="#iconM"></use></svg></button>
<button data-type="indent"><svg><use xlink:href="#iconClose"></use></svg></button>`
const html = `<button data-type="add"><svg><use xlink:href="#iconAdd"></use></svg></button>
<button data-type="indent"><svg class="keyboard__svg--big"><use xlink:href="#iconBIU"></use></svg></button>
<button data-type="indent"><svg><use xlink:href="#iconTrashcan"></use></svg></button>
<span class="keyboard__split"></span>
<button data-type="undo"><svg><use xlink:href="#iconUndo"></use></svg></button> <button data-type="undo"><svg><use xlink:href="#iconUndo"></use></svg></button>
<button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button> <button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button>
</div> <button data-type="redo"><svg><use xlink:href="#iconFont"></use></svg></button>
<span class="fn__flex-1"></span> <button data-type="redo"><svg><use xlink:href="#iconMore"></use></svg></button>
<span class="keyboard__split"></span> <span class="keyboard__split"></span>
<button data-type="done"><svg style="width: 36px"><use xlink:href="#iconRedo"></use></svg></button>` <button data-type="undo"><svg><use xlink:href="#iconIndent"></use></svg></button>
<button data-type="redo"><svg><use xlink:href="#iconOutdent"></use></svg></button>
<button data-type="redo"><svg><use xlink:href="#iconUp"></use></svg></button>
<button data-type="redo"><svg><use xlink:href="#iconDown"></use></svg></button>
`
toolbarElement.innerHTML = `<div class="fn__flex-1">
<div class="keyboard__dynamic">${html}</div>
<div class="fn__none keyboard__dynamic">${inlineHTML}</div>
</div>
<span class="keyboard__split"></span>
<button data-type="done"><svg style="width: 36px"><use xlink:href="#iconKeyboardHide"></use></svg></button>`
} }
export const hideKeyboardToolbar = () => { export const hideKeyboardToolbar = () => {

View file

@ -16,7 +16,7 @@ import {Dialog} from "../../dialog";
import {syncGuide} from "../../sync/syncGuide"; import {syncGuide} from "../../sync/syncGuide";
import {openCard} from "../../card/openCard"; import {openCard} from "../../card/openCard";
import {pathPosix} from "../../util/pathName"; import {pathPosix} from "../../util/pathName";
import {hideKeyboard, hideKeyboardToolbar} from "./showKeyboardToolbar"; import {hideKeyboard, hideKeyboardToolbar} from "./keyboardToolbar";
const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) => { const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) => {
closePanel(); closePanel();

View file

@ -39,7 +39,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
}, { }, {
filter: ["属性试图", "shuxingshitu", "sxst", "attribute view"], filter: ["属性试图", "shuxingshitu", "sxst", "attribute view"],
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>', value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"></svg><span class="b3-list-item__text">TODO</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">TODO</span></div>`,
}, { }, {
filter: ["文档", "子文档", "wendang", "wd", "ziwendang", "zwd", "xjwd"], filter: ["文档", "子文档", "wendang", "wd", "ziwendang", "zwd", "xjwd"],
value: Constants.ZWSP + 4, value: Constants.ZWSP + 4,

View file

@ -25,7 +25,6 @@ import {Background} from "./header/Background";
import {disabledProtyle, enableProtyle, onGet} from "./util/onGet"; import {disabledProtyle, enableProtyle, onGet} from "./util/onGet";
import {reloadProtyle} from "./util/reload"; import {reloadProtyle} from "./util/reload";
import {renderBacklink} from "./wysiwyg/renderBacklink"; import {renderBacklink} from "./wysiwyg/renderBacklink";
import {showKeyboardToolbar} from "../mobile/util/showKeyboardToolbar";
export class Protyle { export class Protyle {

View file

@ -52,7 +52,7 @@ import {pushBack} from "../../util/backForward";
import {openAsset, openBy, openFileById} from "../../editor/util"; import {openAsset, openBy, openFileById} from "../../editor/util";
import {openGlobalSearch} from "../../search/util"; import {openGlobalSearch} from "../../search/util";
/// #else /// #else
import {renderKeyboardToolbar} from "../../mobile/util/showKeyboardToolbar"; import {renderKeyboardToolbar} from "../../mobile/util/keyboardToolbar";
/// #endif /// #endif
import {BlockPanel} from "../../block/Panel"; import {BlockPanel} from "../../block/Panel";
import {isCtrl, openByMobile} from "../util/compatibility"; import {isCtrl, openByMobile} from "../util/compatibility";