This commit is contained in:
parent
e6d55b8845
commit
3adddf4938
2 changed files with 9 additions and 41 deletions
|
@ -3,7 +3,6 @@
|
|||
import type { EditorView } from "prosemirror-view";
|
||||
|
||||
import BlockSelect from "./menubar/BlockSelect.svelte";
|
||||
import AlignSelect from "./menubar/AlignSelect.svelte";
|
||||
// import UploadItem from "./menubar/UploadItem.svelte";
|
||||
import ListItem from "./menubar/ListItem.svelte";
|
||||
import BlockQuoteItem from "./menubar/BlockQuoteItem.svelte";
|
||||
|
@ -15,7 +14,6 @@
|
|||
|
||||
<div class="menubar">
|
||||
<BlockSelect {view} {state} />
|
||||
<AlignSelect {view} {state} />
|
||||
<!-- <UploadItem {view} {state} /> -->
|
||||
<ListItem {view} {state} kind={ListKind.Unordered} />
|
||||
<ListItem {view} {state} kind={ListKind.Ordered} />
|
||||
|
@ -23,14 +21,14 @@
|
|||
</div>
|
||||
|
||||
<style>
|
||||
.menubar {
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
z-index: 69;
|
||||
.menubar {
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
z-index: 69;
|
||||
|
||||
display: flex;
|
||||
display: flex;
|
||||
|
||||
background: var(--background, white);
|
||||
border-bottom: 1px solid var(--accent-bg);
|
||||
}
|
||||
background: var(--background, white);
|
||||
border-bottom: 1px solid var(--accent-bg);
|
||||
}
|
||||
</style>
|
|
@ -1,30 +0,0 @@
|
|||
<script lang="ts">
|
||||
import type { EditorState } from "prosemirror-state";
|
||||
import type { EditorView } from "prosemirror-view";
|
||||
import { getAttrFn, setAlign } from "../ps-utils";
|
||||
import type { Align } from "../schema";
|
||||
|
||||
export let view: EditorView;
|
||||
export let state: EditorState;
|
||||
|
||||
$: isPossible = setAlign(null)(state, null);
|
||||
$: currentValue = getAttrFn("align")(state);
|
||||
|
||||
const onChange = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const { value } = event.target;
|
||||
const align: Align = value === "normal" ? null : value;
|
||||
setAlign(align)(state, view.dispatch);
|
||||
};
|
||||
</script>
|
||||
|
||||
<select
|
||||
value={currentValue === null ? "normal" : currentValue}
|
||||
disabled={!isPossible}
|
||||
on:change={onChange}
|
||||
>
|
||||
<option value="normal">Normal</option>
|
||||
<option value="center">Centro</option>
|
||||
<option value="right">Derecha</option>
|
||||
</select>
|
Loading…
Reference in a new issue