Disable Media button for Codable, but keep wrapping and cloze key for now
This commit is contained in:
parent
2322d170fc
commit
8a07d3161d
@ -4,9 +4,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
-->
|
-->
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import * as tr from "lib/i18n";
|
import * as tr from "lib/i18n";
|
||||||
|
import { disabledKey } from "components/contextKeys";
|
||||||
|
|
||||||
import IconButton from "components/IconButton.svelte";
|
import IconButton from "components/IconButton.svelte";
|
||||||
import WithShortcut from "components/WithShortcut.svelte";
|
import WithShortcut from "components/WithShortcut.svelte";
|
||||||
|
import WithContext from "components/WithContext.svelte";
|
||||||
|
|
||||||
import { bracketsIcon } from "./icons";
|
import { bracketsIcon } from "./icons";
|
||||||
import { forEditorField } from ".";
|
import { forEditorField } from ".";
|
||||||
@ -42,11 +44,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<WithShortcut shortcut={"Control+Alt?+Shift+C"} let:createShortcut let:shortcutLabel>
|
<WithShortcut shortcut={"Control+Alt?+Shift+C"} let:createShortcut let:shortcutLabel>
|
||||||
<IconButton
|
<WithContext key={disabledKey} let:context={disabled}>
|
||||||
tooltip={`${tr.editingClozeDeletion()} (${shortcutLabel})`}
|
<IconButton
|
||||||
on:click={onCloze}
|
tooltip={`${tr.editingClozeDeletion()} (${shortcutLabel})`}
|
||||||
on:mount={createShortcut}
|
{disabled}
|
||||||
>
|
on:click={onCloze}
|
||||||
{@html bracketsIcon}
|
on:mount={createShortcut}
|
||||||
</IconButton>
|
>
|
||||||
|
{@html bracketsIcon}
|
||||||
|
</IconButton>
|
||||||
|
</WithContext>
|
||||||
</WithShortcut>
|
</WithShortcut>
|
||||||
|
@ -5,6 +5,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import * as tr from "lib/i18n";
|
import * as tr from "lib/i18n";
|
||||||
import { bridgeCommand } from "lib/bridgecommand";
|
import { bridgeCommand } from "lib/bridgecommand";
|
||||||
|
import { disabledKey } from "components/contextKeys";
|
||||||
|
import { inCodableKey } from "./contextKeys";
|
||||||
|
|
||||||
import ButtonGroup from "components/ButtonGroup.svelte";
|
import ButtonGroup from "components/ButtonGroup.svelte";
|
||||||
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
|
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
|
||||||
@ -13,7 +15,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
import DropdownItem from "components/DropdownItem.svelte";
|
import DropdownItem from "components/DropdownItem.svelte";
|
||||||
import WithDropdownMenu from "components/WithDropdownMenu.svelte";
|
import WithDropdownMenu from "components/WithDropdownMenu.svelte";
|
||||||
import WithShortcut from "components/WithShortcut.svelte";
|
import WithShortcut from "components/WithShortcut.svelte";
|
||||||
import WithState from "components/WithState.svelte";
|
import WithContext from "components/WithContext.svelte";
|
||||||
|
import OnlyEditable from "./OnlyEditable.svelte";
|
||||||
import ClozeButton from "./ClozeButton.svelte";
|
import ClozeButton from "./ClozeButton.svelte";
|
||||||
|
|
||||||
import { wrap } from "./wrap";
|
import { wrap } from "./wrap";
|
||||||
@ -31,11 +34,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
bridgeCommand("record");
|
bridgeCommand("record");
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkHtmlEdit() {
|
|
||||||
const currentField = getCurrentField();
|
|
||||||
return currentField ? currentField.codable.active : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onHtmlEdit() {
|
function onHtmlEdit() {
|
||||||
const currentField = getCurrentField();
|
const currentField = getCurrentField();
|
||||||
if (currentField) {
|
if (currentField) {
|
||||||
@ -47,30 +45,39 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
<ButtonGroup {api}>
|
<ButtonGroup {api}>
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<WithShortcut shortcut={"F3"} let:createShortcut let:shortcutLabel>
|
<WithShortcut shortcut={"F3"} let:createShortcut let:shortcutLabel>
|
||||||
<IconButton
|
<OnlyEditable let:disabled>
|
||||||
tooltip={appendInParentheses(
|
<IconButton
|
||||||
tr.editingAttachPicturesaudiovideo(),
|
tooltip={appendInParentheses(
|
||||||
shortcutLabel
|
tr.editingAttachPicturesaudiovideo(),
|
||||||
)}
|
shortcutLabel
|
||||||
iconSize={70}
|
)}
|
||||||
on:click={onAttachment}
|
iconSize={70}
|
||||||
on:mount={createShortcut}
|
{disabled}
|
||||||
>
|
on:click={onAttachment}
|
||||||
{@html paperclipIcon}
|
on:mount={createShortcut}
|
||||||
</IconButton>
|
>
|
||||||
|
{@html paperclipIcon}
|
||||||
|
</IconButton>
|
||||||
|
</OnlyEditable>
|
||||||
</WithShortcut>
|
</WithShortcut>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<WithShortcut shortcut={"F5"} let:createShortcut let:shortcutLabel>
|
<WithShortcut shortcut={"F5"} let:createShortcut let:shortcutLabel>
|
||||||
<IconButton
|
<OnlyEditable let:disabled>
|
||||||
tooltip={appendInParentheses(tr.editingRecordAudio(), shortcutLabel)}
|
<IconButton
|
||||||
iconSize={70}
|
tooltip={appendInParentheses(
|
||||||
on:click={onRecord}
|
tr.editingRecordAudio(),
|
||||||
on:mount={createShortcut}
|
shortcutLabel
|
||||||
>
|
)}
|
||||||
{@html micIcon}
|
iconSize={70}
|
||||||
</IconButton>
|
{disabled}
|
||||||
|
on:click={onRecord}
|
||||||
|
on:mount={createShortcut}
|
||||||
|
>
|
||||||
|
{@html micIcon}
|
||||||
|
</IconButton>
|
||||||
|
</OnlyEditable>
|
||||||
</WithShortcut>
|
</WithShortcut>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
@ -173,26 +180,28 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<WithShortcut shortcut={"Control+Shift+X"} let:createShortcut let:shortcutLabel>
|
<WithContext key={disabledKey} let:context={disabled}>
|
||||||
<WithState
|
<WithContext key={inCodableKey} let:context={inCodable}>
|
||||||
key="htmledit"
|
<WithShortcut
|
||||||
update={checkHtmlEdit}
|
shortcut={"Control+Shift+X"}
|
||||||
let:state={active}
|
let:createShortcut
|
||||||
let:updateState
|
let:shortcutLabel
|
||||||
>
|
|
||||||
<IconButton
|
|
||||||
tooltip={appendInParentheses(tr.editingHtmlEditor(), shortcutLabel)}
|
|
||||||
iconSize={70}
|
|
||||||
{active}
|
|
||||||
on:click={(event) => {
|
|
||||||
onHtmlEdit();
|
|
||||||
updateState(event);
|
|
||||||
}}
|
|
||||||
on:mount={createShortcut}
|
|
||||||
>
|
>
|
||||||
{@html xmlIcon}
|
<IconButton
|
||||||
</IconButton>
|
tooltip={appendInParentheses(
|
||||||
</WithState>
|
tr.editingHtmlEditor(),
|
||||||
</WithShortcut>
|
shortcutLabel
|
||||||
|
)}
|
||||||
|
iconSize={70}
|
||||||
|
active={!disabled && inCodable}
|
||||||
|
{disabled}
|
||||||
|
on:click={onHtmlEdit}
|
||||||
|
on:mount={createShortcut}
|
||||||
|
>
|
||||||
|
{@html xmlIcon}
|
||||||
|
</IconButton>
|
||||||
|
</WithShortcut>
|
||||||
|
</WithContext>
|
||||||
|
</WithContext>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user