de2cc20c59
* Add ResizableImage.svelte in ts/editable * Set image constrained via attributes instead of managed style sheet * Implement new constrained size method * Turn WithImageConstrained.svelte into normal ts file * Introduce removeStyleProperties Removes "style" attribute if all style properties were cleared * Avoid --editor-width and use one variable set on container * Disable shrinking if already smaller than shrunken size * Add button to restore image to original size * Don't allow restoring original size if no custom width set * Bottom-center HandleLabel * Satisfy svelte-check
45 lines
1.0 KiB
Svelte
45 lines
1.0 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import { getContext } from "svelte";
|
|
import { createEventDispatcher, onMount } from "svelte";
|
|
import type { Readable } from "svelte/store";
|
|
|
|
import { directionKey } from "../lib/context-keys";
|
|
|
|
const direction = getContext<Readable<"ltr" | "rtl">>(directionKey);
|
|
const dispatch = createEventDispatcher();
|
|
|
|
onMount(() => dispatch("mount"));
|
|
</script>
|
|
|
|
<div class="image-handle-dimensions" class:is-rtl={$direction === "rtl"}>
|
|
<slot />
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
div {
|
|
position: absolute;
|
|
width: fit-content;
|
|
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 3px;
|
|
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
|
|
font-size: 13px;
|
|
color: white;
|
|
background-color: rgba(0 0 0 / 0.3);
|
|
border-color: black;
|
|
border-radius: 5px;
|
|
padding: 0 5px;
|
|
|
|
pointer-events: none;
|
|
user-select: none;
|
|
}
|
|
</style>
|