mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
feat(code-snippet): dispatch "expand," "collapse" events
This commit is contained in:
parent
d2a76060ed
commit
db1265e099
1 changed files with 6 additions and 0 deletions
|
@ -1,4 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
|
/**
|
||||||
|
* @event {null} expand
|
||||||
|
* @event {null} collapse
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the type of code snippet
|
* Set the type of code snippet
|
||||||
* @type {"single" | "inline" | "multi"}
|
* @type {"single" | "inline" | "multi"}
|
||||||
|
@ -117,6 +122,7 @@
|
||||||
if (code === undefined) setShowMoreLess();
|
if (code === undefined) setShowMoreLess();
|
||||||
if (code) tick().then(setShowMoreLess);
|
if (code) tick().then(setShowMoreLess);
|
||||||
}
|
}
|
||||||
|
$: if (type === "multi") dispatch(expanded ? "expand" : "collapse");
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue