Skip to content

Commit

Permalink
Merge branch 'dev-docs' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed May 22, 2024
2 parents f390d02 + e81813e commit 8e4796a
Show file tree
Hide file tree
Showing 17 changed files with 636 additions and 294 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: node env
uses: actions/setup-node@v3
uses: actions/setup-node@v4.0.2
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/

- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.6

- name: install
uses: borales/actions-yarn@v3.0.0
uses: borales/actions-yarn@v5.0.0
with:
cmd: install

- name: build
uses: borales/actions-yarn@v3.0.0
uses: borales/actions-yarn@v5.0.0
with:
cmd: build

- name: publish
uses: JamesIves/github-pages-deploy-action@4.1.5
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
branch: docs
folder: dist
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
})();
</script>
<script src="//at.alicdn.com/t/c/font_2818624_x6jplyhvcoh.js"></script>
<script src="//at.alicdn.com/t/c/font_2818624_m70tdoc8ws8.js"></script>
</head>
<body>
<div id="app"></div>
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "md-editor-v3",
"version": "4.14.1",
"version": "4.15.1",
"keywords": [
"vue",
"vue3",
Expand Down Expand Up @@ -28,18 +28,19 @@
},
"license": "MIT",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build --mode=preview",
"serve": "vite preview"
},
"dependencies": {
"@vavt/cm-extension": "^1.3.0",
"@vavt/cm-extension": "^1.4.2",
"@vavt/v3-extension": "^1.2.1",
"axios": "^1.6.7",
"dayjs": "^1.11.10",
"markdown-it-anchor": "^9.0.1",
"markdown-it-link-attributes": "^4.0.1",
"markdown-it-mark": "^4.0.0",
"md-editor-v3": "^4.14.1",
"md-editor-v3": "^4.15.1",
"nprogress": "^0.2.0",
"vue": "3.2.47",
"vue-router": "^4.3.0",
Expand Down
23 changes: 18 additions & 5 deletions public/doc-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,24 @@ This is the props of `MdPreview`, which is also part of `MdEditor`:

---

### 🕹 codeFoldable

- **type**: `boolean`
- **default**: `true`

Whether to enable code folding feature

---

### ⏲ autoFoldThreshold

- **type**: `number`
- **default**: `30`

Threshold for triggering automatic code folding by line count

---

## 🔩 MdEditor Props

Except for the same as `MdPreview`:
Expand Down Expand Up @@ -1556,9 +1574,6 @@ config({
});
```
<details>
<summary>EditorExtensions</summary>
```ts
export interface EditorExtensions {
highlight?: {
Expand Down Expand Up @@ -1601,8 +1616,6 @@ export interface EditorExtensions {
}
```
</details>
---
### 🥠 editorExtensionsAttrs
Expand Down
23 changes: 18 additions & 5 deletions public/doc-zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,24 @@

---

### 🕹 codeFoldable

- **类型**:`boolean`
- **默认值**:`true`

是否开启折叠代码功能

---

### ⏲ autoFoldThreshold

- **类型**:`number`
- **默认值**:`30`

触发自动折叠代码的行数阈值

---

## 🔩 MdEditor Props

除去和`MdPreivew`相同的以外:
Expand Down Expand Up @@ -1577,9 +1595,6 @@ config({
});
```
<details>
<summary>EditorExtensions</summary>
```ts
export interface EditorExtensions {
highlight?: {
Expand Down Expand Up @@ -1622,8 +1637,6 @@ export interface EditorExtensions {
}
```
</details>
---
### 🥠 editorExtensionsAttrs
Expand Down
63 changes: 63 additions & 0 deletions src/components/Drawer/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@drawerWidth: 200px;

/* 打开抽屉动画 */
@keyframes slideOpen {
from {
transform: translate(100%);
}
to {
transform: translate(0);
}
}

/* 关闭抽屉动画 */
@keyframes slideClose {
from {
transform: translate(0);
}
to {
transform: translate(100%);
}
}

.iz-drawer-root-hidden {
overflow: hidden;
}

.iz-drawer {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.45);
z-index: 1000;
transition: all 0.3s;
display: none;

&-content {
width: @drawerWidth;
height: 100%;
position: absolute;
top: 0;
right: 0;
background-color: var(--iz-bk-color);
z-index: 1001;
overflow: auto;
}
}

.open {
display: block;
&-content {
animation: slideOpen 0.3s ease forwards;
}
}

.close {
&-content {
animation: slideClose 0.3s ease forwards;
}
}
94 changes: 94 additions & 0 deletions src/components/Drawer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import {
Teleport,
cloneVNode,
defineComponent,
nextTick,
reactive,
ref,
useSlots,
watch
} from 'vue';

import './index.less';

const Drawer = defineComponent({
name: 'IzDrawer',
setup() {
const slots = useSlots();
const triggerRef = ref<HTMLElement>();
const contentRef = ref<HTMLElement>();
const containerRef = ref<HTMLElement>();

const state = reactive<{
visible: boolean;
// style: CSSProperties;
// class: string[];
}>({
visible: false
// style: {
// top: 0,
// left: 0
// },
// class: ['dropdown-content', 'animated']
});

const changeVisible = () => {
state.visible = !state.visible;
};

watch(
() => state.visible,
(val) => {
if (val) {
document.documentElement.classList.add('iz-drawer-root-hidden');
containerRef.value?.classList.add('open');
containerRef.value?.classList.remove('close');

nextTick(() => {
contentRef.value?.classList.add('open-content');
contentRef.value?.classList.remove('close-content');
});
} else {
contentRef.value?.classList.add('close-content');
contentRef.value?.classList.remove('open-content');

nextTick(() => {
setTimeout(() => {
containerRef.value?.classList.add('close');
containerRef.value?.classList.remove('open');
document.documentElement.classList.remove('iz-drawer-root-hidden');
}, 300);
});
}
}
);

return () => {
const Trigger = cloneVNode(slots.default!()[0], {
ref: triggerRef,
onClick: changeVisible
});

return (
<>
{Trigger}
<Teleport to={document.body}>
<div class="iz-drawer" ref={containerRef} onClick={changeVisible}>
<div
class="iz-drawer-content"
ref={contentRef}
onClick={(e) => {
e.stopPropagation();
}}
>
{slots.content!()}
</div>
</div>
</Teleport>
</>
);
};
}
});

export default Drawer;
14 changes: 14 additions & 0 deletions src/layouts/Catalog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ const onClick = (e: MouseEvent, t: TocItem) => {
history.replaceState({}, '', `${location.pathname}#${t.text}`);
};
</script>

<style lang="less">
.affix {
position: sticky;
top: 10px;
max-height: 100vh;
overflow: auto;
&::-webkit-scrollbar {
height: 0;
width: 0;
}
}
</style>
Loading

0 comments on commit 8e4796a

Please sign in to comment.