Add support for disabling rich text fields
This commit is contained in:
parent
0005b05829
commit
a0c3ee1c8b
|
@ -17,6 +17,7 @@
|
|||
{height}
|
||||
{id}
|
||||
{fullScreenOffset}
|
||||
{disabled}
|
||||
on:change
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
export let placeholder = null
|
||||
export let id = null
|
||||
export let fullScreenOffset = 0
|
||||
export let disabled = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -48,6 +49,7 @@
|
|||
{height}
|
||||
{id}
|
||||
{fullScreenOffset}
|
||||
{disabled}
|
||||
easyMDEOptions={{
|
||||
initialValue: value,
|
||||
placeholder,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
export let mde = null
|
||||
export let id = null
|
||||
export let fullScreenOffset = 0
|
||||
export let disabled = false
|
||||
|
||||
let element
|
||||
|
||||
|
@ -32,11 +33,28 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
<div style={`--fullscreen-offset:${fullScreenOffset || "0px"}`}>
|
||||
<textarea {id} bind:this={element} />
|
||||
<div class:disabled style={`--fullscreen-offset:${fullScreenOffset || "0px"}`}>
|
||||
<textarea disabled {id} bind:this={element} />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Disabled styles */
|
||||
.disabled :global(textarea) {
|
||||
display: none;
|
||||
}
|
||||
.disabled :global(.CodeMirror-cursor) {
|
||||
display: none;
|
||||
}
|
||||
.disabled :global(.EasyMDEContainer) {
|
||||
pointer-events: none;
|
||||
}
|
||||
.disabled :global(.editor-toolbar button i) {
|
||||
color: var(--spectrum-global-color-gray-400);
|
||||
}
|
||||
.disabled :global(.CodeMirror) {
|
||||
color: var(--spectrum-global-color-gray-600);
|
||||
}
|
||||
|
||||
/* Toolbar container */
|
||||
:global(.EasyMDEContainer .editor-toolbar) {
|
||||
background: var(--spectrum-global-color-gray-50);
|
||||
|
|
Loading…
Reference in New Issue