@forgeroute/ui 0.5.38 โ†’ 0.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,6 @@ import { DividerComponent } from "@forgeroute/ui/divider";
10
10
  import { DateInputComponent } from "@forgeroute/ui/date-input";
11
11
  import { EmptyStateComponent } from "@forgeroute/ui/empty-state";
12
12
  import { ErrorComponent } from "@forgeroute/ui/error";
13
- import { PillTabsComponent } from "@forgeroute/ui/pill-tabs";
14
13
  import { RadioGroupComponent } from "@forgeroute/ui/radio";
15
14
  import { SearchInputComponent } from "@forgeroute/ui/search-input";
16
15
  import { SelectComponent } from "@forgeroute/ui/select";
@@ -1801,9 +1800,10 @@ const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS = [{
1801
1800
  }
1802
1801
  ]
1803
1802
  }];
1803
+ const EMAIL_DEFAULT_FONT = "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif";
1804
1804
  function buildPreviewDocument(bodyHtml, brand) {
1805
1805
  const b = safePreviewBrand(brand);
1806
- const font = b.fontFamily ?? "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif";
1806
+ const font = b.fontFamily ?? "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif";
1807
1807
  const head = b.logoUrl || b.companyName ? "<div class=\"brand-head\">" + (b.logoUrl ? `<img src="${escapeHtml(b.logoUrl)}" alt="">` : "") + (b.companyName ? `<span>${escapeHtml(b.companyName)}</span>` : "") + "</div>" : "";
1808
1808
  const foot = b.footerText ? `<div class="brand-foot">${escapeHtml(b.footerText).replace(/\r?\n/g, "<br>")}</div>` : "";
1809
1809
  return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src * data:; style-src 'unsafe-inline'; font-src data:"><meta name="viewport" content="width=device-width, initial-scale=1"><style>html,body{margin:0}body{padding:24px 28px;font:15px/1.6 ${font};color:${b.textColor ?? "#1e293b"};${b.backgroundColor ? `background:${b.backgroundColor};` : ""}overflow-wrap:anywhere}p{margin:0 0 8px}img{max-width:100%}table{max-width:100%}a{color:${b.linkColor ?? "#3b82f6"}}.brand-head{display:flex;align-items:center;gap:12px;margin:0 0 16px;font-weight:600}.brand-head img{max-height:48px;width:auto}.brand-foot{margin:24px 0 0;padding-top:12px;border-top:1px solid rgba(100,116,139,.35);font-size:12px;line-height:1.5;color:#64748b}</style></head><body>${head}${bodyHtml}${foot}</body></html>`;
@@ -1869,6 +1869,232 @@ function localizedEmailVariableGroups() {
1869
1869
  }))
1870
1870
  }));
1871
1871
  }
1872
+ const EMAIL_EMOJI_GROUP_KEYS = [
1873
+ {
1874
+ key: "smileys",
1875
+ icon: "๐Ÿ˜€"
1876
+ },
1877
+ {
1878
+ key: "gestures",
1879
+ icon: "๐Ÿ‘‹"
1880
+ },
1881
+ {
1882
+ key: "hearts",
1883
+ icon: "โค๏ธ"
1884
+ },
1885
+ {
1886
+ key: "remembrance",
1887
+ icon: "๐Ÿ•Š๏ธ"
1888
+ },
1889
+ {
1890
+ key: "pets",
1891
+ icon: "๐Ÿถ"
1892
+ },
1893
+ {
1894
+ key: "nature",
1895
+ icon: "๐ŸŒณ"
1896
+ },
1897
+ {
1898
+ key: "food",
1899
+ icon: "๐ŸŽ"
1900
+ },
1901
+ {
1902
+ key: "places",
1903
+ icon: "๐Ÿš—"
1904
+ },
1905
+ {
1906
+ key: "objects",
1907
+ icon: "๐Ÿ’ก"
1908
+ },
1909
+ {
1910
+ key: "symbols",
1911
+ icon: "โœ…"
1912
+ }
1913
+ ];
1914
+ const EMAIL_SKIN_TONES = [
1915
+ {
1916
+ key: "default",
1917
+ modifier: "",
1918
+ swatch: "๐Ÿ‘‹"
1919
+ },
1920
+ {
1921
+ key: "light",
1922
+ modifier: "๐Ÿป",
1923
+ swatch: "๐Ÿ‘‹๐Ÿป"
1924
+ },
1925
+ {
1926
+ key: "mediumLight",
1927
+ modifier: "๐Ÿผ",
1928
+ swatch: "๐Ÿ‘‹๐Ÿผ"
1929
+ },
1930
+ {
1931
+ key: "medium",
1932
+ modifier: "๐Ÿฝ",
1933
+ swatch: "๐Ÿ‘‹๐Ÿฝ"
1934
+ },
1935
+ {
1936
+ key: "mediumDark",
1937
+ modifier: "๐Ÿพ",
1938
+ swatch: "๐Ÿ‘‹๐Ÿพ"
1939
+ },
1940
+ {
1941
+ key: "dark",
1942
+ modifier: "๐Ÿฟ",
1943
+ swatch: "๐Ÿ‘‹๐Ÿฟ"
1944
+ }
1945
+ ];
1946
+ const EMAIL_EMOJIS = Object.entries({
1947
+ smileys: "๐Ÿ˜€ grinning happy;๐Ÿ˜ƒ smile happy open;๐Ÿ˜„ smile happy eyes;๐Ÿ˜ grin beaming;๐Ÿ˜† laugh squint;๐Ÿ˜… sweat smile relief;๐Ÿคฃ rofl laughing floor;๐Ÿ˜‚ joy tears laughing;๐Ÿ™‚ slight smile;๐Ÿ™ƒ upside down;๐Ÿ˜‰ wink;๐Ÿ˜Š blush smile;๐Ÿ˜‡ angel halo innocent;๐Ÿฅฐ love hearts adore;๐Ÿ˜ heart eyes love;๐Ÿคฉ star struck wow;๐Ÿ˜˜ kiss blow;๐Ÿ˜— kiss;๐Ÿ˜š kiss closed eyes;๐Ÿ˜‹ yum tasty;๐Ÿ˜› tongue;๐Ÿ˜œ wink tongue;๐Ÿคช zany crazy;๐Ÿค— hug;๐Ÿคญ giggle oops;๐Ÿค” thinking hmm;๐Ÿค zipper quiet;๐Ÿ˜ neutral;๐Ÿ˜‘ expressionless;๐Ÿ˜ถ no mouth silent;๐Ÿ˜ smirk;๐Ÿ˜’ unamused;๐Ÿ™„ eye roll;๐Ÿ˜ฌ grimace;๐Ÿ˜Œ relieved calm;๐Ÿ˜” pensive sad;๐Ÿ˜ช sleepy;๐Ÿ˜ด sleeping zzz;๐Ÿ˜ท mask sick;๐Ÿค’ thermometer sick fever;๐Ÿค• bandage hurt;๐Ÿคข nauseated;๐Ÿฅต hot;๐Ÿฅถ cold freezing;๐Ÿฅด woozy;๐Ÿ˜ต dizzy;๐Ÿคฏ mind blown;๐Ÿค  cowboy;๐Ÿฅณ party celebrate;๐Ÿ˜Ž cool sunglasses;๐Ÿค“ nerd;๐Ÿง monocle;๐Ÿ˜• confused;๐Ÿ˜Ÿ worried;๐Ÿ™ frown;โ˜น๏ธ frowning;๐Ÿ˜ฎ surprised open mouth;๐Ÿ˜ฏ hushed;๐Ÿ˜ฒ astonished;๐Ÿ˜ณ flushed embarrassed;๐Ÿฅบ pleading puppy eyes;๐Ÿ˜ฆ frown open;๐Ÿ˜ง anguished;๐Ÿ˜จ fearful;๐Ÿ˜ฐ anxious sweat;๐Ÿ˜ฅ sad relieved;๐Ÿ˜ข cry tear;๐Ÿ˜ญ sob crying;๐Ÿ˜ฑ scream fear;๐Ÿ˜– confounded;๐Ÿ˜ฃ persevere;๐Ÿ˜ž disappointed;๐Ÿ˜“ downcast sweat;๐Ÿ˜ฉ weary;๐Ÿ˜ซ tired;๐Ÿฅฑ yawn;๐Ÿ˜ค triumph huff;๐Ÿ˜ก angry pouting;๐Ÿ˜  angry;๐Ÿคฌ cursing swearing;๐Ÿ˜ˆ devil smile;๐Ÿ‘ฟ imp angry;๐Ÿ’€ skull;โ˜ ๏ธ skull crossbones;๐Ÿ’ฉ poop;๐Ÿคก clown;๐Ÿ‘ป ghost;๐Ÿ‘ฝ alien;๐Ÿค– robot",
1948
+ gestures: "๐Ÿ‘‹+ wave hello hi goodbye;๐Ÿคš+ raised back hand;๐Ÿ–๏ธ+ hand fingers splayed;โœ‹+ raised hand stop high five;๐Ÿ‘Œ+ ok hand perfect;๐ŸคŒ+ pinched fingers;โœŒ๏ธ+ victory peace;๐Ÿคž+ crossed fingers luck;๐ŸคŸ+ love you gesture;๐Ÿค˜+ rock horns;๐Ÿ‘ˆ+ point left;๐Ÿ‘‰+ point right;๐Ÿ‘†+ point up;๐Ÿ‘‡+ point down;โ˜๏ธ+ index up;๐Ÿ‘+ thumbs up yes like approve;๐Ÿ‘Ž+ thumbs down no dislike;โœŠ+ raised fist;๐Ÿ‘Š+ fist bump;๐Ÿ‘+ clap applause;๐Ÿ™Œ+ raising hands celebrate praise;๐Ÿ‘+ open hands;๐Ÿคฒ+ palms up together;๐Ÿค handshake agreement deal;๐Ÿ™+ pray thanks please folded hands;โœ๏ธ+ writing hand;๐Ÿ’…+ nail polish;๐Ÿคณ+ selfie;๐Ÿ’ช+ muscle strong flex;๐Ÿซถ+ heart hands love;๐Ÿซ‚ people hugging comfort;๐Ÿ‘‚+ ear listen;๐Ÿ‘€ eyes look;๐Ÿง  brain;๐Ÿซ€ heart organ",
1949
+ hearts: "โค๏ธ red heart love;๐Ÿงก orange heart;๐Ÿ’› yellow heart;๐Ÿ’š green heart;๐Ÿ’™ blue heart;๐Ÿ’œ purple heart;๐ŸคŽ brown heart;๐Ÿ–ค black heart;๐Ÿค white heart;๐Ÿ’” broken heart;โฃ๏ธ heart exclamation;๐Ÿ’• two hearts;๐Ÿ’ž revolving hearts;๐Ÿ’“ beating heart;๐Ÿ’— growing heart;๐Ÿ’– sparkling heart;๐Ÿ’˜ heart arrow cupid;๐Ÿ’ heart ribbon gift;โค๏ธโ€๐Ÿฉน mending heart healing;โœจ sparkles shine;โญ star;๐ŸŒŸ glowing star;๐Ÿ’ซ dizzy star;๐Ÿ”ฅ fire hot;๐Ÿ’ฅ collision boom;๐ŸŽ‰ party popper celebrate;๐ŸŽŠ confetti",
1950
+ remembrance: "๐Ÿ•Š๏ธ dove peace;๐Ÿ•ฏ๏ธ candle remember;๐ŸŒน rose flower;๐Ÿฅ€ wilted flower;๐ŸŒท tulip;๐ŸŒธ cherry blossom;๐ŸŒบ hibiscus;๐Ÿ’ bouquet flowers;๐ŸŒป sunflower;๐ŸŒผ blossom;๐Ÿชท lotus;๐Ÿต๏ธ rosette;๐ŸŒฟ herb leaf;๐Ÿƒ leaves wind;๐Ÿ‚ fallen leaf autumn;๐ŸŒˆ rainbow;โ˜€๏ธ sun;๐ŸŒ… sunrise;๐ŸŒ„ sunrise mountains;๐ŸŒ™ moon crescent;โญ star night;๐ŸŒ  shooting star wish;โ˜๏ธ cloud;๐ŸŒค๏ธ sun behind cloud;โšฑ๏ธ urn funeral;๐Ÿชฆ headstone grave;โ›ช church;โœ๏ธ cross;โ˜ช๏ธ star crescent;๐Ÿ•‰๏ธ om;โœก๏ธ star of david;โ˜ฎ๏ธ peace symbol;๐Ÿ™ praying thanks;๐Ÿซถ heart hands;๐Ÿค white heart;๐Ÿ‘ผ baby angel;๐Ÿ˜‡ angel;๐Ÿงฟ nazar;๐Ÿชฝ wing",
1951
+ pets: "๐Ÿถ dog face;๐Ÿ• dog;๐Ÿฆฎ guide dog;๐Ÿ•โ€๐Ÿฆบ service dog;๐Ÿฉ poodle;๐Ÿบ wolf;๐Ÿฑ cat face;๐Ÿˆ cat;๐Ÿˆโ€โฌ› black cat;๐Ÿฆ lion;๐Ÿฏ tiger;๐Ÿด horse face;๐ŸŽ horse;๐Ÿฆ„ unicorn;๐Ÿฐ rabbit face;๐Ÿ‡ rabbit;๐Ÿน hamster;๐Ÿญ mouse;๐Ÿ€ rat;๐Ÿฟ๏ธ chipmunk squirrel;๐Ÿฆ” hedgehog;๐Ÿฆ bird;๐Ÿฆœ parrot;๐Ÿฆ† duck;๐Ÿฆข swan;๐Ÿ•Š๏ธ dove;๐Ÿข turtle;๐Ÿ snake;๐ŸฆŽ lizard;๐Ÿ  tropical fish;๐ŸŸ fish;๐Ÿก blowfish;๐Ÿพ paw prints;๐Ÿฆด bone;๐Ÿฎ cow;๐Ÿท pig;๐Ÿ‘ sheep;๐Ÿ goat;๐Ÿ“ rooster;๐Ÿฃ chick;๐Ÿป bear;๐Ÿผ panda;๐ŸฆŠ fox;๐Ÿฆ raccoon;๐Ÿจ koala;๐Ÿฆ‹ butterfly;๐Ÿ bee;๐Ÿž ladybug",
1952
+ nature: "๐ŸŒณ tree;๐ŸŒฒ evergreen;๐ŸŒด palm;๐ŸŒต cactus;๐ŸŒพ grain;๐Ÿ€ clover luck;๐Ÿ maple leaf;๐ŸŒฑ seedling grow;๐Ÿชด plant;๐ŸŒ earth;๐ŸŒŠ wave ocean;โ›ฐ๏ธ mountain;๐Ÿ”๏ธ snow mountain;๐ŸŒ‹ volcano;๐Ÿž๏ธ park;๐Ÿ–๏ธ beach;๐ŸŒง๏ธ rain;โ›ˆ๏ธ storm;โ„๏ธ snowflake;โ›„ snowman;๐ŸŒฌ๏ธ wind;๐Ÿ’ง drop water;๐Ÿ”† bright;๐ŸŒŒ milky way night;๐Ÿช planet",
1953
+ food: "๐ŸŽ apple;๐Ÿ pear;๐ŸŠ orange;๐Ÿ‹ lemon;๐ŸŒ banana;๐Ÿ‰ watermelon;๐Ÿ‡ grapes;๐Ÿ“ strawberry;๐Ÿ’ cherries;๐Ÿ‘ peach;๐Ÿฅญ mango;๐Ÿ pineapple;๐Ÿฅ kiwi;๐Ÿ… tomato;๐Ÿฅ‘ avocado;๐Ÿฅ• carrot;๐ŸŒฝ corn;๐Ÿฅ croissant;๐Ÿž bread;๐Ÿง€ cheese;๐Ÿณ egg cooking;๐Ÿฅž pancakes;๐Ÿ” burger;๐Ÿ• pizza;๐ŸŒฎ taco;๐Ÿฅ— salad;๐Ÿ pasta;๐Ÿฐ cake;๐ŸŽ‚ birthday cake;๐Ÿช cookie;๐Ÿซ chocolate;๐Ÿฉ donut;โ˜• coffee;๐Ÿต tea;๐Ÿท wine;๐Ÿฅ‚ cheers toast;๐Ÿฝ๏ธ plate dinner",
1954
+ places: "๐Ÿ  house home;๐Ÿก house garden;๐Ÿข office building;๐Ÿฅ hospital;๐Ÿ›๏ธ classical building;โ›ช church;๐Ÿ•Œ mosque;๐Ÿ• synagogue;๐Ÿซ school;๐Ÿจ hotel;๐Ÿช store;๐Ÿš— car;๐Ÿš™ suv;๐Ÿš van;๐Ÿšš truck delivery;๐Ÿš‘ ambulance;๐Ÿš“ police;๐Ÿšฒ bicycle;โœˆ๏ธ airplane;๐Ÿš† train;๐Ÿšข ship;๐Ÿ“ pin location;๐Ÿ—บ๏ธ map;๐Ÿงญ compass;๐Ÿ›ฃ๏ธ road;๐ŸŒ‰ bridge;๐ŸŒ† city;๐ŸŒ‡ sunset city;โ›บ camping;๐Ÿ“ž phone call;๐Ÿ“ฑ mobile phone;โ˜Ž๏ธ telephone;๐Ÿ“ง email;โœ‰๏ธ envelope mail;๐Ÿ“ฎ mailbox;๐Ÿ“ฌ mail",
1955
+ objects: "๐Ÿ’ก idea light bulb;๐Ÿ”” bell notification;๐Ÿ”• bell off;๐Ÿ“… calendar date;๐Ÿ—“๏ธ calendar spiral;โฐ alarm clock;โฑ๏ธ stopwatch;๐Ÿ• clock;โŒ› hourglass;๐Ÿ“„ document page;๐Ÿ“‹ clipboard;๐Ÿ“ memo note write;๐Ÿ“ folder;๐Ÿ“Ž paperclip attach;๐Ÿ“Œ pushpin;โœ‚๏ธ scissors;๐Ÿ”’ lock secure;๐Ÿ”“ unlock;๐Ÿ”‘ key;๐Ÿ’ณ credit card payment;๐Ÿ’ต dollar money;๐Ÿ’ฐ money bag;๐Ÿงพ receipt;๐Ÿ“ฆ package box;๐ŸŽ gift present;๐ŸŽ—๏ธ ribbon remembrance;๐Ÿ† trophy;๐ŸŽ–๏ธ medal;๐Ÿ“ท camera photo;๐ŸŽฅ movie camera;๐ŸŽต music note;๐Ÿ“ฃ megaphone announce;๐Ÿ” magnifying glass search;๐Ÿ› ๏ธ tools;โš™๏ธ gear settings;๐Ÿงฐ toolbox;๐Ÿ“Š chart;๐Ÿ“ˆ chart up;๐Ÿ–Š๏ธ pen;๐Ÿ–‹๏ธ fountain pen;๐Ÿ“– book;๐Ÿ“š books;๐ŸŽ“ graduation;๐Ÿชช id card;๐Ÿ›ก๏ธ shield",
1956
+ symbols: "โœ… check yes done;โ˜‘๏ธ checked box;โœ”๏ธ check mark;โŒ cross no;โŽ cross button;โš ๏ธ warning;โ„น๏ธ information;โ“ question;โ— exclamation;โ€ผ๏ธ double exclamation;โž• plus;โž– minus;โžก๏ธ arrow right;โฌ…๏ธ arrow left;โฌ†๏ธ arrow up;โฌ‡๏ธ arrow down;โ†ฉ๏ธ return;๐Ÿ”„ refresh;๐Ÿ”— link;โ™ป๏ธ recycle;๐Ÿ’ฏ hundred;๐Ÿ†— ok;๐Ÿ†• new;๐Ÿ”ด red circle;๐ŸŸ  orange circle;๐ŸŸก yellow circle;๐ŸŸข green circle;๐Ÿ”ต blue circle;๐ŸŸฃ purple circle;โšซ black circle;โšช white circle;โ–ถ๏ธ play;โธ๏ธ pause;๐Ÿ”Š sound;๐Ÿ”‡ mute;๐Ÿ finish flag;๐Ÿšฉ flag;ยฉ๏ธ copyright;ยฎ๏ธ registered;โ„ข๏ธ trademark"
1957
+ }).flatMap(([group, table]) => table.split(";").map((entry) => {
1958
+ const space = entry.indexOf(" ");
1959
+ const head = entry.slice(0, space);
1960
+ const tone = head.endsWith("+");
1961
+ return {
1962
+ char: tone ? head.slice(0, -1) : head,
1963
+ words: entry.slice(space + 1),
1964
+ group,
1965
+ tone
1966
+ };
1967
+ }));
1968
+ function findEmojis(search, group) {
1969
+ const fold = (t) => t.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
1970
+ const terms = fold(search).split(/\s+/).filter(Boolean);
1971
+ if (terms.length === 0) return EMAIL_EMOJIS.filter((e) => e.group === group);
1972
+ return EMAIL_EMOJIS.filter((e) => terms.every((t) => fold(e.words).includes(t)));
1973
+ }
1974
+ function withSkinTone(emoji, modifier) {
1975
+ if (!emoji.tone || !modifier) return emoji.char;
1976
+ return Array.from(emoji.char)[0] + modifier;
1977
+ }
1978
+ const EMAIL_SPECIAL_CHARACTERS = [
1979
+ "ยฉ",
1980
+ "ยฎ",
1981
+ "โ„ข",
1982
+ "ยฐ",
1983
+ "ยฑ",
1984
+ "ร—",
1985
+ "รท",
1986
+ "โ€ข",
1987
+ "ยท",
1988
+ "โ€“",
1989
+ "โ€”",
1990
+ "โ€ฆ",
1991
+ "โ€˜",
1992
+ "โ€™",
1993
+ "โ€œ",
1994
+ "โ€",
1995
+ "ยซ",
1996
+ "ยป",
1997
+ "โ€น",
1998
+ "โ€บ",
1999
+ "โ‚ฌ",
2000
+ "ยฃ",
2001
+ "ยฅ",
2002
+ "ยข",
2003
+ "$",
2004
+ "ยง",
2005
+ "ยถ",
2006
+ "โ€ ",
2007
+ "โ€ก",
2008
+ "โ€ฐ",
2009
+ "โ„–",
2010
+ "โ†",
2011
+ "โ†’",
2012
+ "โ†‘",
2013
+ "โ†“",
2014
+ "โ†”",
2015
+ "โ‡’",
2016
+ "โ‡",
2017
+ "โœ“",
2018
+ "โœ”",
2019
+ "โœ—",
2020
+ "โœ˜",
2021
+ "โ˜…",
2022
+ "โ˜†",
2023
+ "โ™ฅ",
2024
+ "โ™ฆ",
2025
+ "โ™ฃ",
2026
+ "โ™ ",
2027
+ "โ™ช",
2028
+ "โ˜Ž",
2029
+ "โœ‰",
2030
+ "โœ†",
2031
+ "ยฝ",
2032
+ "โ…“",
2033
+ "ยผ",
2034
+ "ยพ",
2035
+ "ยฒ",
2036
+ "ยณ",
2037
+ "ยน",
2038
+ "ยต",
2039
+ "ฮฑ",
2040
+ "ฮฒ",
2041
+ "ฯ€",
2042
+ "ฮฉ",
2043
+ "โˆž",
2044
+ "โ‰ˆ",
2045
+ "โ‰ ",
2046
+ "โ‰ค",
2047
+ "โ‰ฅ",
2048
+ "โˆš",
2049
+ "โˆ‘",
2050
+ "รก",
2051
+ "รฉ",
2052
+ "รญ",
2053
+ "รณ",
2054
+ "รบ",
2055
+ "รฑ",
2056
+ "รผ",
2057
+ "ร",
2058
+ "ร‰",
2059
+ "ร",
2060
+ "ร“",
2061
+ "รš",
2062
+ "ร‘",
2063
+ "รœ",
2064
+ "ยฟ",
2065
+ "ยก",
2066
+ "รง",
2067
+ "รฃ",
2068
+ "รต",
2069
+ "รช",
2070
+ "รจ",
2071
+ "ร ",
2072
+ "รข",
2073
+ "รด"
2074
+ ];
2075
+ const DOCUMENT_STYLES = `
2076
+ .tpl-doc p { margin: 0 0 8px; }
2077
+ .tpl-doc h1 { font-size: 2em; font-weight: bold; margin: 0.67em 0; color: #1e293b; }
2078
+ .tpl-doc h2 { font-size: 1.5em; font-weight: bold; margin: 0.83em 0; color: #1e293b; }
2079
+ .tpl-doc h3 { font-size: 1.17em; font-weight: bold; margin: 1em 0; color: #1e293b; }
2080
+ .tpl-doc h4 { font-size: 1em; font-weight: bold; margin: 1.33em 0; }
2081
+ .tpl-doc blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid #cbd5e1; color: #475569; }
2082
+ .tpl-doc table { border-collapse: collapse; width: 100%; margin: 8px 0; }
2083
+ .tpl-doc td, .tpl-doc th { border: 1px solid #cbd5e1; padding: 8px; vertical-align: top; min-width: 24px; }
2084
+ .tpl-doc hr { border: 0; border-top: 1px solid #cbd5e1; margin: 16px 0; }
2085
+ .tpl-doc a { color: #3b82f6; }
2086
+ .tpl-doc img { max-width: 100%; border-radius: 6px; }
2087
+ .tpl-doc ul, .tpl-doc ol { padding-left: 40px; margin: 1em 0; }
2088
+ .tpl-doc ul { list-style-type: disc; }
2089
+ .tpl-doc ol { list-style-type: decimal; }
2090
+ `;
2091
+ function ensureDocumentStyles() {
2092
+ if (typeof document === "undefined" || document.head.querySelector("style[data-tpl-doc-styles]")) return;
2093
+ const style = document.createElement("style");
2094
+ style.setAttribute("data-tpl-doc-styles", "");
2095
+ style.textContent = DOCUMENT_STYLES;
2096
+ document.head.appendChild(style);
2097
+ }
1872
2098
  const FONT_SIZE_OPTIONS = [
1873
2099
  "10",
1874
2100
  "12",
@@ -1884,10 +2110,51 @@ const FONT_SIZE_OPTIONS = [
1884
2110
  value: `${n}px`,
1885
2111
  label: `${n}px`
1886
2112
  }));
1887
- const BLOCK_BASE_PADDING_PX = 12;
2113
+ const COLOR_SWATCHES = [
2114
+ "#000000",
2115
+ "#1e293b",
2116
+ "#475569",
2117
+ "#64748b",
2118
+ "#94a3b8",
2119
+ "#cbd5e1",
2120
+ "#e2e8f0",
2121
+ "#f1f5f9",
2122
+ "#f8fafc",
2123
+ "#ffffff",
2124
+ "#dc2626",
2125
+ "#ea580c",
2126
+ "#d97706",
2127
+ "#ca8a04",
2128
+ "#16a34a",
2129
+ "#0d9488",
2130
+ "#0284c7",
2131
+ "#2563eb",
2132
+ "#7c3aed",
2133
+ "#c026d3",
2134
+ "#fecaca",
2135
+ "#fed7aa",
2136
+ "#fde68a",
2137
+ "#fef08a",
2138
+ "#bbf7d0",
2139
+ "#99f6e4",
2140
+ "#bae6fd",
2141
+ "#bfdbfe",
2142
+ "#ddd6fe",
2143
+ "#f5d0fe",
2144
+ "#991b1b",
2145
+ "#9a3412",
2146
+ "#92400e",
2147
+ "#854d0e",
2148
+ "#166534",
2149
+ "#115e59",
2150
+ "#075985",
2151
+ "#1e40af",
2152
+ "#5b21b6",
2153
+ "#86198f"
2154
+ ];
1888
2155
  function setEditorSpacing(el, spacing) {
1889
- el.style.paddingTop = spacing ? `calc(${BLOCK_BASE_PADDING_PX}px + ${spacing})` : "";
1890
- el.style.paddingBottom = spacing ? `calc(${BLOCK_BASE_PADDING_PX}px + ${spacing})` : "";
2156
+ el.style.paddingTop = spacing ?? "";
2157
+ el.style.paddingBottom = spacing ?? "";
1891
2158
  }
1892
2159
  const DEFAULT_VIDEO_LINK = (video) => video.shareLink;
1893
2160
  const EMPTY_VIDEO_DEFAULTS = {
@@ -1899,11 +2166,15 @@ const EMPTY_VIDEO_DEFAULTS = {
1899
2166
  hideReactions: false
1900
2167
  };
1901
2168
  var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2169
+ onActiveFromChange(value) {
2170
+ this.activeFrom.set(value ?? "");
2171
+ if (value && this.activeTo() && this.activeTo() < value) this.activeTo.set("");
2172
+ }
1902
2173
  get headingOptions() {
1903
2174
  return this._headingOptions();
1904
2175
  }
1905
- get spacingTabs() {
1906
- return this._spacingTabs();
2176
+ get spacingOptions() {
2177
+ return this._spacingOptions();
1907
2178
  }
1908
2179
  get ctaTypeOptions() {
1909
2180
  return this._ctaTypeOptions();
@@ -1919,7 +2190,9 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
1919
2190
  this.categories = input([], ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
1920
2191
  this.showCategory = input(true, ...ngDevMode ? [{ debugName: "showCategory" }] : /* istanbul ignore next */ []);
1921
2192
  this.showActiveRange = input(true, ...ngDevMode ? [{ debugName: "showActiveRange" }] : /* istanbul ignore next */ []);
2193
+ this.showSaveHint = input(true, ...ngDevMode ? [{ debugName: "showSaveHint" }] : /* istanbul ignore next */ []);
1922
2194
  this.previewBrand = input(null, ...ngDevMode ? [{ debugName: "previewBrand" }] : /* istanbul ignore next */ []);
2195
+ this.canvasFont = computed(() => safePreviewBrand(this.previewBrand()).fontFamily ?? "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif", ...ngDevMode ? [{ debugName: "canvasFont" }] : /* istanbul ignore next */ []);
1923
2196
  this.previewSampleData = input(false, ...ngDevMode ? [{ debugName: "previewSampleData" }] : /* istanbul ignore next */ []);
1924
2197
  this.imageUpload = input(null, ...ngDevMode ? [{ debugName: "imageUpload" }] : /* istanbul ignore next */ []);
1925
2198
  this.categoryPlaceholderInput = input(null, {
@@ -1939,6 +2212,16 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
1939
2212
  alias: "variableGroups"
1940
2213
  });
1941
2214
  this.variableGroups = computed(() => this.variableGroupsInput() ?? localizedEmailVariableGroups(), ...ngDevMode ? [{ debugName: "variableGroups" }] : /* istanbul ignore next */ []);
2215
+ this.variablesNeedAssignment = computed(() => this.assignmentOptions().length > 0 && this.assignedKeys().length === 0, ...ngDevMode ? [{ debugName: "variablesNeedAssignment" }] : /* istanbul ignore next */ []);
2216
+ this.availableVariableGroups = computed(() => {
2217
+ if (this.assignmentOptions().length === 0) return this.variableGroups();
2218
+ const assigned = this.assignedKeys();
2219
+ if (assigned.length === 0) return [];
2220
+ return this.variableGroups().map((g) => ({
2221
+ ...g,
2222
+ variables: g.variables.filter((v) => !v.appliesTo || v.appliesTo.some((k) => assigned.includes(k)))
2223
+ })).filter((g) => g.variables.length > 0);
2224
+ }, ...ngDevMode ? [{ debugName: "availableVariableGroups" }] : /* istanbul ignore next */ []);
1942
2225
  this.blockGroupsInput = input(null, {
1943
2226
  ...ngDevMode ? { debugName: "blockGroupsInput" } : /* istanbul ignore next */ {},
1944
2227
  alias: "blockGroups"
@@ -1995,8 +2278,13 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
1995
2278
  this.subject = signal("", ...ngDevMode ? [{ debugName: "subject" }] : /* istanbul ignore next */ []);
1996
2279
  this.category = signal("", ...ngDevMode ? [{ debugName: "category" }] : /* istanbul ignore next */ []);
1997
2280
  this.useAllYear = signal(true, ...ngDevMode ? [{ debugName: "useAllYear" }] : /* istanbul ignore next */ []);
2281
+ this.today = (() => {
2282
+ const d = /* @__PURE__ */ new Date();
2283
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
2284
+ })();
1998
2285
  this.activeFrom = signal("", ...ngDevMode ? [{ debugName: "activeFrom" }] : /* istanbul ignore next */ []);
1999
2286
  this.activeTo = signal("", ...ngDevMode ? [{ debugName: "activeTo" }] : /* istanbul ignore next */ []);
2287
+ this.activeToMin = computed(() => this.activeFrom() > this.today ? this.activeFrom() : this.today, ...ngDevMode ? [{ debugName: "activeToMin" }] : /* istanbul ignore next */ []);
2000
2288
  this.videoId = signal(null, ...ngDevMode ? [{ debugName: "videoId" }] : /* istanbul ignore next */ []);
2001
2289
  this.videoTitle = signal(null, ...ngDevMode ? [{ debugName: "videoTitle" }] : /* istanbul ignore next */ []);
2002
2290
  this.assignedKeys = signal([], ...ngDevMode ? [{ debugName: "assignedKeys" }] : /* istanbul ignore next */ []);
@@ -2010,15 +2298,13 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2010
2298
  this.savedRange = null;
2011
2299
  this.blockEditors = viewChildren("blockEditor", ...ngDevMode ? [{ debugName: "blockEditors" }] : /* istanbul ignore next */ []);
2012
2300
  this.colorInputRef = viewChild("colorInput", ...ngDevMode ? [{ debugName: "colorInputRef" }] : /* istanbul ignore next */ []);
2301
+ this.highlightInputRef = viewChild("highlightInput", ...ngDevMode ? [{ debugName: "highlightInputRef" }] : /* istanbul ignore next */ []);
2013
2302
  this.loadedBody = signal(null, ...ngDevMode ? [{ debugName: "loadedBody" }] : /* istanbul ignore next */ []);
2014
2303
  this.bodyEdited = signal(false, ...ngDevMode ? [{ debugName: "bodyEdited" }] : /* istanbul ignore next */ []);
2015
2304
  this.savedSnapshot = signal(null, ...ngDevMode ? [{ debugName: "savedSnapshot" }] : /* istanbul ignore next */ []);
2016
2305
  this.dragFromPalette = null;
2017
- this.dragFromCanvas = signal(null, ...ngDevMode ? [{ debugName: "dragFromCanvas" }] : /* istanbul ignore next */ []);
2018
- this.dragOverIndex = signal(null, ...ngDevMode ? [{ debugName: "dragOverIndex" }] : /* istanbul ignore next */ []);
2019
2306
  this.currentColor = signal("#1e293b", ...ngDevMode ? [{ debugName: "currentColor" }] : /* istanbul ignore next */ []);
2020
2307
  this.blockSpacing = signal("", ...ngDevMode ? [{ debugName: "blockSpacing" }] : /* istanbul ignore next */ []);
2021
- this.headingKey = signal(0, ...ngDevMode ? [{ debugName: "headingKey" }] : /* istanbul ignore next */ []);
2022
2308
  this.sizeKey = signal(0, ...ngDevMode ? [{ debugName: "sizeKey" }] : /* istanbul ignore next */ []);
2023
2309
  this._headingOptions = computed(() => [
2024
2310
  {
@@ -2039,24 +2325,27 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2039
2325
  }
2040
2326
  ], ...ngDevMode ? [{ debugName: "_headingOptions" }] : /* istanbul ignore next */ []);
2041
2327
  this.fontSizeOptions = FONT_SIZE_OPTIONS;
2042
- this._spacingTabs = computed(() => [
2043
- {
2044
- key: "none",
2045
- label: this.labels.t("emailTemplateEditor.spacing.none")
2046
- },
2047
- {
2048
- key: "8px",
2049
- label: this.labels.t("emailTemplateEditor.spacing.small")
2050
- },
2051
- {
2052
- key: "16px",
2053
- label: this.labels.t("emailTemplateEditor.spacing.medium")
2054
- },
2055
- {
2056
- key: "32px",
2057
- label: this.labels.t("emailTemplateEditor.spacing.large")
2058
- }
2059
- ], ...ngDevMode ? [{ debugName: "_spacingTabs" }] : /* istanbul ignore next */ []);
2328
+ this._spacingOptions = computed(() => {
2329
+ const lead = this.labels.t("emailTemplateEditor.spacingShort");
2330
+ return [
2331
+ {
2332
+ value: "none",
2333
+ label: `${lead}: ${this.labels.t("emailTemplateEditor.spacing.none")}`
2334
+ },
2335
+ {
2336
+ value: "8px",
2337
+ label: `${lead}: ${this.labels.t("emailTemplateEditor.spacing.small")}`
2338
+ },
2339
+ {
2340
+ value: "16px",
2341
+ label: `${lead}: ${this.labels.t("emailTemplateEditor.spacing.medium")}`
2342
+ },
2343
+ {
2344
+ value: "32px",
2345
+ label: `${lead}: ${this.labels.t("emailTemplateEditor.spacing.large")}`
2346
+ }
2347
+ ];
2348
+ }, ...ngDevMode ? [{ debugName: "_spacingOptions" }] : /* istanbul ignore next */ []);
2060
2349
  this.startPlaceholder = computed(() => this.labels.t("emailTemplateEditor.startWriting"), ...ngDevMode ? [{ debugName: "startPlaceholder" }] : /* istanbul ignore next */ []);
2061
2350
  this._ctaTypeOptions = computed(() => [
2062
2351
  {
@@ -2084,6 +2373,24 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2084
2373
  label: this.labels.t("emailTemplateEditor.playback.autoplay")
2085
2374
  }], ...ngDevMode ? [{ debugName: "_playbackOptions" }] : /* istanbul ignore next */ []);
2086
2375
  this.showLinkDialog = signal(false, ...ngDevMode ? [{ debugName: "showLinkDialog" }] : /* istanbul ignore next */ []);
2376
+ this.showEmojiPanel = signal(false, ...ngDevMode ? [{ debugName: "showEmojiPanel" }] : /* istanbul ignore next */ []);
2377
+ this.colorPanel = signal(null, ...ngDevMode ? [{ debugName: "colorPanel" }] : /* istanbul ignore next */ []);
2378
+ this.colorSwatches = COLOR_SWATCHES;
2379
+ this.brandTextColor = computed(() => this.previewBrand()?.textColor ?? "#1e293b", ...ngDevMode ? [{ debugName: "brandTextColor" }] : /* istanbul ignore next */ []);
2380
+ this.showSpecialPanel = signal(false, ...ngDevMode ? [{ debugName: "showSpecialPanel" }] : /* istanbul ignore next */ []);
2381
+ this.emojiGroupKeys = EMAIL_EMOJI_GROUP_KEYS;
2382
+ this.specialCharacters = EMAIL_SPECIAL_CHARACTERS;
2383
+ this.emojiSearch = signal("", ...ngDevMode ? [{ debugName: "emojiSearch" }] : /* istanbul ignore next */ []);
2384
+ this.emojiTone = signal("", ...ngDevMode ? [{ debugName: "emojiTone" }] : /* istanbul ignore next */ []);
2385
+ this.emojiGroup = signal("smileys", ...ngDevMode ? [{ debugName: "emojiGroup" }] : /* istanbul ignore next */ []);
2386
+ this.skinToneOptions = computed(() => EMAIL_SKIN_TONES.map((t) => ({
2387
+ value: t.modifier,
2388
+ label: this.toneLabel(t.key)
2389
+ })), ...ngDevMode ? [{ debugName: "skinToneOptions" }] : /* istanbul ignore next */ []);
2390
+ this.shownEmojis = computed(() => findEmojis(this.emojiSearch(), this.emojiGroup()), ...ngDevMode ? [{ debugName: "shownEmojis" }] : /* istanbul ignore next */ []);
2391
+ this.headingValue = signal("p", ...ngDevMode ? [{ debugName: "headingValue" }] : /* istanbul ignore next */ []);
2392
+ this.currentHighlight = signal("#fde68a", ...ngDevMode ? [{ debugName: "currentHighlight" }] : /* istanbul ignore next */ []);
2393
+ this.inTable = signal(false, ...ngDevMode ? [{ debugName: "inTable" }] : /* istanbul ignore next */ []);
2087
2394
  this.linkUrl = signal("", ...ngDevMode ? [{ debugName: "linkUrl" }] : /* istanbul ignore next */ []);
2088
2395
  this.linkText = signal("", ...ngDevMode ? [{ debugName: "linkText" }] : /* istanbul ignore next */ []);
2089
2396
  this.linkTextFromSelection = signal(false, ...ngDevMode ? [{ debugName: "linkTextFromSelection" }] : /* istanbul ignore next */ []);
@@ -2110,9 +2417,14 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2110
2417
  this.filteredAssignments = computed(() => {
2111
2418
  const featured = this.featuredAssignmentKey();
2112
2419
  const all = this.assignmentState();
2113
- const ordered = featured ? [...all.filter((a) => a.key === featured), ...all.filter((a) => a.key !== featured)] : all;
2420
+ const grouped = all.some((a) => a.group);
2421
+ const ordered = featured && !grouped ? [...all.filter((a) => a.key === featured), ...all.filter((a) => a.key !== featured)] : all;
2114
2422
  const q = this.assignmentSearch().trim().toLowerCase();
2115
- return q ? ordered.filter((a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q)) : ordered;
2423
+ const shown = q ? ordered.filter((a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q)) : ordered;
2424
+ return shown.map((a, i) => ({
2425
+ ...a,
2426
+ groupStart: !!a.group && a.group !== shown[i - 1]?.group
2427
+ }));
2116
2428
  }, ...ngDevMode ? [{ debugName: "filteredAssignments" }] : /* istanbul ignore next */ []);
2117
2429
  this.filteredBlockGroups = computed(() => {
2118
2430
  const q = this.blockSearch().trim().toLowerCase();
@@ -2197,7 +2509,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2197
2509
  return !url || isWebUrl(url) ? "" : this.labels.t("emailTemplateEditor.validImageAddress");
2198
2510
  }, ...ngDevMode ? [{ debugName: "imageUrlError" }] : /* istanbul ignore next */ []);
2199
2511
  this.canInsertImage = computed(() => !!this.imageUrl().trim() && !this.imageUrlError() && !this.imageUploading(), ...ngDevMode ? [{ debugName: "canInsertImage" }] : /* istanbul ignore next */ []);
2200
- this.emailChecks = computed(() => findEmailChecks(this.subject(), this.serialized(), this.variableGroups().flatMap((g) => g.variables.map((v) => v.key))), ...ngDevMode ? [{ debugName: "emailChecks" }] : /* istanbul ignore next */ []);
2512
+ this.emailChecks = computed(() => findEmailChecks(this.subject(), this.serialized(), (this.variablesNeedAssignment() ? this.variableGroups() : this.availableVariableGroups()).flatMap((g) => g.variables.map((v) => v.key))), ...ngDevMode ? [{ debugName: "emailChecks" }] : /* istanbul ignore next */ []);
2201
2513
  this.checkMessages = computed(() => {
2202
2514
  const c = this.emailChecks();
2203
2515
  return [
@@ -2212,6 +2524,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2212
2524
  }, ...ngDevMode ? [{ debugName: "testEmailError" }] : /* istanbul ignore next */ []);
2213
2525
  this.canSendTest = computed(() => this.canWrite() && !!this.editingId() && !!this.testSendEmail().trim() && !this.testEmailError() && !this.testSending(), ...ngDevMode ? [{ debugName: "canSendTest" }] : /* istanbul ignore next */ []);
2214
2526
  this.hasUnsavedChanges = computed(() => !!this.editingId() && this.savedSnapshot() !== null && this.savedSnapshot() !== this.snapshot(), ...ngDevMode ? [{ debugName: "hasUnsavedChanges" }] : /* istanbul ignore next */ []);
2527
+ ensureDocumentStyles();
2215
2528
  effect(() => {
2216
2529
  const t = this.template();
2217
2530
  untracked(() => this.applyTemplate(t));
@@ -2268,12 +2581,14 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2268
2581
  this.activeTo.set(t?.activeTo ?? "");
2269
2582
  this.videoId.set(t?.videoId ?? null);
2270
2583
  this.videoTitle.set(t?.videoTitle ?? null);
2271
- this.blocks.set(!t || !t.id && !(t.body ?? "").trim() ? [{
2584
+ this.blocks.set([{
2272
2585
  id: this.genId(),
2273
- html: ""
2274
- }] : this.htmlToBlocks(t.body ?? ""));
2275
- this.selectedBlockId.set(this.blocks()[0]?.id ?? null);
2276
- this.blockSpacing.set(this.blocks()[0]?.spacing ?? "");
2586
+ html: !t || !t.id && !(t.body ?? "").trim() ? "" : this.htmlToDocument(t.body ?? "")
2587
+ }]);
2588
+ this.selectedBlockId.set(this.blocks()[0].id);
2589
+ this.blockSpacing.set("");
2590
+ this.headingValue.set("p");
2591
+ this.inTable.set(false);
2277
2592
  this.loadedBody.set(t?.id ? t.body ?? "" : null);
2278
2593
  this.bodyEdited.set(false);
2279
2594
  this.bodyBlurred.set(false);
@@ -2327,36 +2642,13 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2327
2642
  ]);
2328
2643
  }
2329
2644
  serialize(blocks) {
2330
- return blocks.map((b) => {
2331
- return `<div data-block="true">${b.spacing ? `<div data-spacing="true" style="padding:${b.spacing} 0">${b.html}</div>` : b.html}</div>`;
2332
- }).join("");
2645
+ return `<div data-block="true">${blocks.map((b) => b.html).join("")}</div>`;
2333
2646
  }
2334
- htmlToBlocks(html) {
2335
- if (!html || !html.trim()) return [{
2336
- id: this.genId(),
2337
- html: "<p></p>"
2338
- }];
2339
- const div = new DOMParser().parseFromString(html, "text/html").body;
2340
- const blockDivs = Array.from(div.querySelectorAll(":scope > [data-block]"));
2341
- if (blockDivs.length > 0) return blockDivs.map((el) => {
2342
- const spacingEl = el.querySelector(":scope > [data-spacing]");
2343
- if (spacingEl) {
2344
- const spacing = spacingEl.style.padding?.split(" ")[0] || void 0;
2345
- return {
2346
- id: this.genId(),
2347
- html: spacingEl.innerHTML,
2348
- spacing
2349
- };
2350
- }
2351
- return {
2352
- id: this.genId(),
2353
- html: el.innerHTML
2354
- };
2355
- });
2356
- return [{
2357
- id: this.genId(),
2358
- html
2359
- }];
2647
+ htmlToDocument(html) {
2648
+ if (!html || !html.trim()) return "<p></p>";
2649
+ const body = new DOMParser().parseFromString(html, "text/html").body;
2650
+ const blockDivs = Array.from(body.querySelectorAll(":scope > [data-block]"));
2651
+ return blockDivs.length > 0 ? blockDivs.map((el) => el.innerHTML).join("") : html;
2360
2652
  }
2361
2653
  genId() {
2362
2654
  return Math.random().toString(36).slice(2, 10);
@@ -2392,67 +2684,26 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2392
2684
  if (tab === "edit" && previous !== "edit") this.initializedBlockIds = /* @__PURE__ */ new Set();
2393
2685
  this.activeEditorTab.set(tab);
2394
2686
  }
2395
- addBlock(blockKey = "text-block") {
2396
- if (!this.canWrite()) return;
2397
- this.addBlockHtml(this.blockHtml(blockKey));
2398
- }
2399
- addBlockHtml(html, at) {
2687
+ addBlockHtml(html) {
2400
2688
  this.bodyEdited.set(true);
2401
- const block = {
2402
- id: this.genId(),
2403
- html
2404
- };
2405
- this.blocks.update((list) => at === void 0 ? [...list, block] : [
2406
- ...list.slice(0, at),
2407
- block,
2408
- ...list.slice(at)
2409
- ]);
2410
- this.selectedBlockId.set(block.id);
2411
- return block;
2412
- }
2413
- deleteBlock(index) {
2414
- if (!this.canWrite()) return;
2415
- const list = this.blocks();
2416
- if (index < 0 || index >= list.length) return;
2417
- if (list.length === 1) return;
2418
- this.bodyEdited.set(true);
2419
- this.initializedBlockIds.delete(list[index].id);
2420
- const next = list.filter((_, i) => i !== index);
2421
- this.blocks.set(next);
2422
- this.selectedBlockId.set(next[Math.min(index, next.length - 1)].id);
2423
- }
2424
- duplicateBlock(index) {
2425
- if (!this.canWrite()) return;
2426
- const list = this.blocks();
2427
- if (index < 0 || index >= list.length) return;
2428
- this.bodyEdited.set(true);
2429
- const src = list[index];
2430
- const html = this.editorFor(src.id)?.nativeElement.innerHTML ?? src.html;
2431
- const copy = {
2432
- id: this.genId(),
2433
- html,
2434
- spacing: src.spacing
2435
- };
2436
- this.blocks.set([
2437
- ...list.slice(0, index + 1),
2438
- copy,
2439
- ...list.slice(index + 1)
2440
- ]);
2441
- this.selectedBlockId.set(copy.id);
2442
- }
2443
- moveBlock(index, direction) {
2444
- if (!this.canWrite()) return;
2445
- const list = this.blocks();
2446
- const target = index + direction;
2447
- if (index < 0 || index >= list.length || target < 0 || target >= list.length) return;
2448
- this.bodyEdited.set(true);
2449
- const next = [...list];
2450
- [next[index], next[target]] = [next[target], next[index]];
2451
- this.blocks.set(next);
2689
+ const editor = this.editorFor(this.selectedBlockId())?.nativeElement;
2690
+ if (editor) {
2691
+ this.restoreSelection();
2692
+ const sel = window.getSelection();
2693
+ if (!!sel && sel.rangeCount > 0 && insideEditorBlock(sel.getRangeAt(0).commonAncestorContainer)) document.execCommand("insertHTML", false, html);
2694
+ else editor.insertAdjacentHTML("beforeend", html);
2695
+ this.syncBlock();
2696
+ return;
2697
+ }
2698
+ this.blocks.update((list) => list.map((b, i) => i === 0 ? {
2699
+ ...b,
2700
+ html: b.html + html
2701
+ } : b));
2452
2702
  }
2453
2703
  onBlockInput(event, block) {
2454
2704
  if (!this.canWrite()) return;
2455
2705
  this.bodyEdited.set(true);
2706
+ this.wrapBareText(event.target);
2456
2707
  const html = event.target.innerHTML;
2457
2708
  this.blocks.update((list) => list.map((b) => b.id === block.id ? {
2458
2709
  ...b,
@@ -2477,7 +2728,81 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2477
2728
  }
2478
2729
  onBlockFocus(block) {
2479
2730
  this.selectedBlockId.set(block.id);
2480
- this.blockSpacing.set(block.spacing ?? "");
2731
+ document.execCommand("defaultParagraphSeparator", false, "p");
2732
+ this.refreshContext();
2733
+ }
2734
+ wrapBareText(editor) {
2735
+ const INLINE = /* @__PURE__ */ new Set([
2736
+ "B",
2737
+ "STRONG",
2738
+ "I",
2739
+ "EM",
2740
+ "U",
2741
+ "S",
2742
+ "STRIKE",
2743
+ "SPAN",
2744
+ "A",
2745
+ "FONT",
2746
+ "SUB",
2747
+ "SUP",
2748
+ "BR",
2749
+ "IMG",
2750
+ "MARK"
2751
+ ]);
2752
+ const isLoose = (n) => n.nodeType === 3 || n instanceof HTMLElement && INLINE.has(n.tagName);
2753
+ const nodes = Array.from(editor.childNodes);
2754
+ if (!nodes.some((n) => isLoose(n) && (n.nodeType !== 3 || (n.textContent ?? "").trim() !== ""))) return;
2755
+ const sel = window.getSelection();
2756
+ const anchor = sel && sel.rangeCount > 0 ? {
2757
+ node: sel.anchorNode,
2758
+ offset: sel.anchorOffset
2759
+ } : null;
2760
+ let run = [];
2761
+ const flush = () => {
2762
+ if (run.length === 0) return;
2763
+ const p = document.createElement("p");
2764
+ editor.insertBefore(p, run[0]);
2765
+ run.forEach((n) => p.appendChild(n));
2766
+ run = [];
2767
+ };
2768
+ for (const n of nodes) if (isLoose(n)) run.push(n);
2769
+ else flush();
2770
+ flush();
2771
+ if (anchor?.node && anchor.node.isConnected && sel) {
2772
+ const range = document.createRange();
2773
+ range.setStart(anchor.node, anchor.offset);
2774
+ range.collapse(true);
2775
+ sel.removeAllRanges();
2776
+ sel.addRange(range);
2777
+ }
2778
+ }
2779
+ refreshContext() {
2780
+ const top = this.topLevelAtCaret();
2781
+ const tag = top?.tagName.toLowerCase() ?? "p";
2782
+ this.headingValue.set([
2783
+ "h1",
2784
+ "h2",
2785
+ "h3"
2786
+ ].includes(tag) ? tag : "p");
2787
+ const pad = (top?.hasAttribute("data-spacing") ? top : null)?.style.paddingTop ?? "";
2788
+ this.blockSpacing.set([
2789
+ "8px",
2790
+ "16px",
2791
+ "32px"
2792
+ ].includes(pad) ? pad : "");
2793
+ const sel = window.getSelection();
2794
+ const node = sel && sel.rangeCount > 0 ? sel.getRangeAt(0).commonAncestorContainer : null;
2795
+ const el = node instanceof Element ? node : node?.parentElement;
2796
+ this.inTable.set(!!el && insideEditorBlock(el) && !!el.closest("td, th"));
2797
+ }
2798
+ topLevelAtCaret() {
2799
+ const editor = this.editorFor(this.selectedBlockId())?.nativeElement;
2800
+ const sel = window.getSelection();
2801
+ if (!editor || !sel || sel.rangeCount === 0) return null;
2802
+ let node = sel.getRangeAt(0).startContainer;
2803
+ if (!editor.contains(node)) return null;
2804
+ while (node && node.parentNode !== editor) node = node.parentNode;
2805
+ return node instanceof HTMLElement ? node : null;
2481
2806
  }
2482
2807
  onPaletteDragStart(event, block) {
2483
2808
  if (!this.canWrite()) {
@@ -2485,64 +2810,39 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2485
2810
  return;
2486
2811
  }
2487
2812
  this.dragFromPalette = block;
2488
- this.dragFromCanvas.set(null);
2489
2813
  event.dataTransfer.effectAllowed = "copy";
2490
2814
  event.dataTransfer.setData(EMAIL_BLOCK_DRAG_TYPE, block.key);
2491
2815
  }
2492
- onBlockDragStart(event, index, wrapper) {
2493
- if (!this.canWrite()) {
2494
- event.preventDefault();
2495
- return;
2496
- }
2497
- if (event.target !== event.currentTarget) return;
2498
- this.dragFromCanvas.set(index);
2499
- this.dragFromPalette = null;
2500
- event.dataTransfer.effectAllowed = "move";
2501
- event.dataTransfer.setData(EMAIL_BLOCK_DRAG_TYPE, String(index));
2502
- if (wrapper) event.dataTransfer.setDragImage?.(wrapper, 0, 0);
2503
- event.stopPropagation();
2504
- }
2505
2816
  onBlockDragEnd() {
2506
- this.dragFromCanvas.set(null);
2507
2817
  this.dragFromPalette = null;
2508
- this.dragOverIndex.set(null);
2509
- }
2510
- onCanvasDragOver(event) {
2511
- if (this.canWrite() && isBlockDrag(event)) event.preventDefault();
2512
- }
2513
- onDropZoneDragOver(event, index) {
2514
- if (!this.canWrite() || !isBlockDrag(event)) return;
2515
- event.preventDefault();
2516
- event.dataTransfer.dropEffect = this.dragFromPalette ? "copy" : "move";
2517
- if (this.dragOverIndex() !== index) this.dragOverIndex.set(index);
2518
- }
2519
- onDropZoneLeave() {
2520
- this.dragOverIndex.set(null);
2521
2818
  }
2522
- onDropZoneDrop(event, insertBefore) {
2523
- if (!this.canWrite()) {
2819
+ onDocDragOver(event) {
2820
+ if (this.canWrite() && isBlockDrag(event)) {
2524
2821
  event.preventDefault();
2525
- return;
2822
+ event.dataTransfer.dropEffect = "copy";
2526
2823
  }
2527
- const fromCanvas = this.dragFromCanvas();
2528
- if (this.dragFromPalette === null && fromCanvas === null) return;
2824
+ }
2825
+ onDocDrop(event) {
2826
+ if (!this.canWrite() || this.dragFromPalette === null) return;
2529
2827
  event.preventDefault();
2530
- this.dragOverIndex.set(null);
2531
- if (this.dragFromPalette) {
2532
- const html = this.dragFromPalette.html;
2533
- this.dragFromPalette = null;
2534
- this.addBlockHtml(html, insertBefore);
2535
- } else if (fromCanvas !== null) {
2536
- const to = fromCanvas < insertBefore ? insertBefore - 1 : insertBefore;
2537
- if (fromCanvas !== to) {
2538
- const next = [...this.blocks()];
2539
- const [moved] = next.splice(fromCanvas, 1);
2540
- next.splice(to, 0, moved);
2541
- this.blocks.set(next);
2542
- this.bodyEdited.set(true);
2543
- }
2544
- this.dragFromCanvas.set(null);
2828
+ const html = this.dragFromPalette.html;
2829
+ this.dragFromPalette = null;
2830
+ const doc = document;
2831
+ const range = document.caretRangeFromPoint?.(event.clientX, event.clientY) ?? (() => {
2832
+ const pos = doc.caretPositionFromPoint?.(event.clientX, event.clientY);
2833
+ if (!pos) return null;
2834
+ const r = document.createRange();
2835
+ r.setStart(pos.offsetNode, pos.offset);
2836
+ return r;
2837
+ })();
2838
+ if (range && insideEditorBlock(range.commonAncestorContainer)) {
2839
+ range.collapse(true);
2840
+ const sel = window.getSelection();
2841
+ sel?.removeAllRanges();
2842
+ sel?.addRange(range);
2843
+ this.savedRange = range.cloneRange();
2545
2844
  }
2845
+ this.addBlockHtml(html);
2546
2846
  }
2547
2847
  preventFocusLoss(event) {
2548
2848
  if (event.target?.closest?.("select, input")) return;
@@ -2561,6 +2861,10 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2561
2861
  sel?.removeAllRanges();
2562
2862
  sel?.addRange(saved);
2563
2863
  }
2864
+ focusEditor() {
2865
+ const editor = this.editorFor(this.selectedBlockId())?.nativeElement;
2866
+ if (editor && document.activeElement !== editor) editor.focus({ preventScroll: true });
2867
+ }
2564
2868
  activeBlockHtml() {
2565
2869
  return this.editorFor(this.selectedBlockId())?.nativeElement.innerHTML ?? null;
2566
2870
  }
@@ -2578,16 +2882,55 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2578
2882
  document.execCommand(cmd, false, value ?? void 0);
2579
2883
  });
2580
2884
  if (cmd === "insertUnorderedList" || cmd === "insertOrderedList") this.styleNewLists();
2885
+ if (cmd === "insertHorizontalRule" || cmd === "formatBlock" && value === "blockquote") this.styleNewBlocks();
2581
2886
  this.syncBlock();
2887
+ this.refreshContext();
2888
+ }
2889
+ styleNewBlocks() {
2890
+ const doc = this.editorFor(this.selectedBlockId())?.nativeElement;
2891
+ doc?.querySelectorAll("hr:not([style])").forEach((hr) => hr.setAttribute("style", "border:0;border-top:1px solid #cbd5e1;margin:16px 0"));
2892
+ doc?.querySelectorAll("table:not([style])").forEach((t) => t.setAttribute("style", "border-collapse:collapse;width:100%;margin:8px 0"));
2893
+ doc?.querySelectorAll("td:not([style]), th:not([style])").forEach((c) => c.setAttribute("style", "border:1px solid #cbd5e1;padding:8px;vertical-align:top"));
2894
+ doc?.querySelectorAll("blockquote:not([style])").forEach((q) => q.setAttribute("style", "margin:1em 0;padding:4px 16px;border-left:4px solid #cbd5e1;color:#475569"));
2582
2895
  }
2583
2896
  styleNewLists() {
2584
2897
  (this.editorFor(this.selectedBlockId())?.nativeElement)?.querySelectorAll("ul:not([style]), ol:not([style])").forEach((list) => {
2585
2898
  list.setAttribute("style", `list-style-type:${list.tagName === "OL" ? "decimal" : "disc"};padding-left:40px;margin:1em 0`);
2586
2899
  });
2587
2900
  }
2901
+ onDocEnter(event) {
2902
+ const node = window.getSelection()?.anchorNode ?? null;
2903
+ const el = node instanceof Element ? node : node?.parentElement ?? null;
2904
+ const quote = el?.closest("blockquote");
2905
+ if (!quote || !this.canWrite()) return;
2906
+ const line = el.closest("blockquote > *") ?? el;
2907
+ if ((line?.textContent ?? "").trim() !== "" && line !== quote) return;
2908
+ if (line === quote && quote.textContent?.trim()) return;
2909
+ event.preventDefault();
2910
+ this.execCommand("formatBlock", "p");
2911
+ this.stripQuoteLook();
2912
+ }
2913
+ stripQuoteLook() {
2914
+ (this.editorFor(this.selectedBlockId())?.nativeElement)?.querySelectorAll("[style*=\"border-left\"]").forEach((el) => {
2915
+ if (el.tagName === "BLOCKQUOTE" || el.closest("blockquote")) return;
2916
+ [
2917
+ "border-left",
2918
+ "padding",
2919
+ "margin",
2920
+ "color"
2921
+ ].forEach((p) => el.style.removeProperty(p));
2922
+ if (!el.getAttribute("style")) el.removeAttribute("style");
2923
+ });
2924
+ this.syncBlock();
2925
+ }
2926
+ toggleQuote() {
2927
+ const node = window.getSelection()?.anchorNode ?? null;
2928
+ const leaving = !!(node instanceof Element ? node : node?.parentElement ?? null)?.closest("blockquote");
2929
+ this.execCommand("formatBlock", leaving ? "p" : "blockquote");
2930
+ if (leaving) this.stripQuoteLook();
2931
+ }
2588
2932
  onHeading(value) {
2589
2933
  this.execCommand("formatBlock", value);
2590
- this.headingKey.update((k) => k + 1);
2591
2934
  }
2592
2935
  onFontSize(value) {
2593
2936
  this.applyFontSize(value);
@@ -2622,25 +2965,168 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2622
2965
  });
2623
2966
  this.syncBlock();
2624
2967
  }
2625
- openColorPicker() {
2968
+ toggleColorPanel(which) {
2969
+ if (!this.canWrite()) return;
2970
+ this.showLinkDialog.set(false);
2971
+ this.showImageDialog.set(false);
2972
+ this.showEmojiPanel.set(false);
2973
+ this.showSpecialPanel.set(false);
2974
+ this.colorPanel.update((v) => v === which ? null : which);
2975
+ }
2976
+ pickColor(which, color) {
2977
+ this.colorPanel.set(null);
2978
+ if (which === "text") this.applyTextColor(color);
2979
+ else this.applyHighlight(color);
2980
+ }
2981
+ removeColor(which) {
2982
+ this.colorPanel.set(null);
2983
+ if (which === "text") this.applyTextColor(this.brandTextColor());
2984
+ else {
2985
+ this.runEditCommand(() => {
2986
+ document.execCommand("styleWithCSS", false, "true");
2987
+ document.execCommand("hiliteColor", false, "transparent");
2988
+ });
2989
+ this.syncBlock();
2990
+ }
2991
+ }
2992
+ openCustomColor(which) {
2626
2993
  this.saveSelection();
2627
- this.colorInputRef()?.nativeElement.click();
2994
+ (which === "text" ? this.colorInputRef() : this.highlightInputRef())?.nativeElement.showPicker?.();
2995
+ (which === "text" ? this.colorInputRef() : this.highlightInputRef())?.nativeElement.click();
2628
2996
  }
2629
2997
  applySpacing(value) {
2630
2998
  if (!this.canWrite()) return;
2999
+ this.restoreSelection();
3000
+ const editor = this.editorFor(this.selectedBlockId())?.nativeElement;
3001
+ let top = this.topLevelAtCaret();
3002
+ if (editor && !top) {
3003
+ top = editor.querySelector(":scope > *") ?? null;
3004
+ if (!top && editor.textContent) {
3005
+ editor.innerHTML = `<p>${editor.innerHTML}</p>`;
3006
+ top = editor.firstElementChild;
3007
+ }
3008
+ }
3009
+ if (!editor || !top) {
3010
+ this.blockSpacing.set(value);
3011
+ return;
3012
+ }
3013
+ if ((top.hasAttribute("data-spacing") ? top.style.paddingTop : "") === value) {
3014
+ this.blockSpacing.set(value);
3015
+ return;
3016
+ }
3017
+ if (top.hasAttribute("data-spacing")) {
3018
+ if (value) top.style.padding = `${value} 0`;
3019
+ else {
3020
+ while (top.firstChild) top.parentNode.insertBefore(top.firstChild, top);
3021
+ top.remove();
3022
+ }
3023
+ } else if (value) {
3024
+ const wrapper = document.createElement("div");
3025
+ wrapper.setAttribute("data-spacing", "true");
3026
+ wrapper.setAttribute("style", `padding:${value} 0`);
3027
+ top.parentNode.insertBefore(wrapper, top);
3028
+ wrapper.appendChild(top);
3029
+ }
3030
+ this.bodyEdited.set(true);
2631
3031
  this.blockSpacing.set(value);
2632
- const id = this.selectedBlockId();
2633
- if (!id) return;
2634
- const ref = this.editorFor(id);
2635
- if (ref) setEditorSpacing(ref.nativeElement, value);
2636
- const block = this.blocks().find((b) => b.id === id);
2637
- if (!block) return;
2638
- const changed = (block.spacing ?? "") !== (value ?? "");
2639
- this.blocks.update((list) => list.map((b) => b.id === id ? {
2640
- ...b,
2641
- spacing: value || void 0
2642
- } : b));
2643
- if (changed) this.bodyEdited.set(true);
3032
+ this.syncBlock();
3033
+ }
3034
+ applyHighlight(color) {
3035
+ if (!this.canWrite()) return;
3036
+ this.currentHighlight.set(color);
3037
+ this.runEditCommand(() => {
3038
+ document.execCommand("styleWithCSS", false, "true");
3039
+ document.execCommand("hiliteColor", false, color);
3040
+ });
3041
+ this.syncBlock();
3042
+ }
3043
+ insertTable() {
3044
+ if (!this.canWrite()) return;
3045
+ const row = `<tr>${`<td style="border:1px solid #cbd5e1;padding:8px;vertical-align:top"><br></td>`.repeat(3)}</tr>`;
3046
+ this.runEditCommand(() => {
3047
+ document.execCommand("insertHTML", false, `<table style="border-collapse:collapse;width:100%;margin:8px 0"><tbody>${row.repeat(3)}</tbody></table><p><br></p>`);
3048
+ });
3049
+ this.styleNewBlocks();
3050
+ this.bodyEdited.set(true);
3051
+ this.syncBlock();
3052
+ this.refreshContext();
3053
+ }
3054
+ currentCell() {
3055
+ const sel = window.getSelection();
3056
+ const node = sel && sel.rangeCount > 0 ? sel.getRangeAt(0).startContainer : null;
3057
+ const cell = (node instanceof Element ? node : node?.parentElement)?.closest("td, th") ?? null;
3058
+ return cell && insideEditorBlock(cell) ? cell : null;
3059
+ }
3060
+ editTable(change) {
3061
+ if (!this.canWrite()) return;
3062
+ this.restoreSelection();
3063
+ const cell = this.currentCell();
3064
+ const row = cell?.parentElement;
3065
+ const table = cell?.closest("table") ?? null;
3066
+ if (!cell || !row || !table) return;
3067
+ change(cell, row, table);
3068
+ this.bodyEdited.set(true);
3069
+ this.syncBlock();
3070
+ this.refreshContext();
3071
+ }
3072
+ newCell(like) {
3073
+ const c = document.createElement("td");
3074
+ c.setAttribute("style", like.getAttribute("style") ?? "border:1px solid #cbd5e1;padding:8px;vertical-align:top");
3075
+ c.innerHTML = "<br>";
3076
+ return c;
3077
+ }
3078
+ tableAddRow() {
3079
+ this.editTable((_cell, row) => {
3080
+ const copy = document.createElement("tr");
3081
+ Array.from(row.cells).forEach((c) => copy.appendChild(this.newCell(c)));
3082
+ row.after(copy);
3083
+ });
3084
+ }
3085
+ tableAddColumn() {
3086
+ this.editTable((cell, _row, table) => {
3087
+ const index = cell.cellIndex;
3088
+ Array.from(table.rows).forEach((r) => {
3089
+ const ref = r.cells[index];
3090
+ if (ref) ref.after(this.newCell(ref));
3091
+ });
3092
+ });
3093
+ }
3094
+ placeCaretInCell(cell) {
3095
+ if (!cell) return;
3096
+ const range = document.createRange();
3097
+ range.selectNodeContents(cell);
3098
+ range.collapse(true);
3099
+ const sel = window.getSelection();
3100
+ sel?.removeAllRanges();
3101
+ sel?.addRange(range);
3102
+ }
3103
+ tableDeleteRow() {
3104
+ this.editTable((cell, row, table) => {
3105
+ if (table.rows.length <= 1) {
3106
+ table.remove();
3107
+ return;
3108
+ }
3109
+ const neighbour = row.nextElementSibling ?? row.previousElementSibling;
3110
+ const index = cell.cellIndex;
3111
+ row.remove();
3112
+ this.placeCaretInCell(neighbour?.cells[index] ?? neighbour?.cells[0]);
3113
+ });
3114
+ }
3115
+ tableDeleteColumn() {
3116
+ this.editTable((cell, _row, table) => {
3117
+ const index = cell.cellIndex;
3118
+ if (table.rows[0]?.cells.length <= 1) {
3119
+ table.remove();
3120
+ return;
3121
+ }
3122
+ const row = cell.parentElement;
3123
+ const neighbour = cell.nextElementSibling ?? cell.previousElementSibling;
3124
+ Array.from(table.rows).forEach((r) => r.cells[index]?.remove());
3125
+ this.placeCaretInCell(neighbour ?? row.cells[0]);
3126
+ });
3127
+ }
3128
+ tableDelete() {
3129
+ this.editTable((_cell, _row, table) => table.remove());
2644
3130
  }
2645
3131
  anchorAtSelection() {
2646
3132
  const sel = window.getSelection();
@@ -2652,6 +3138,8 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2652
3138
  }
2653
3139
  openLinkDialog() {
2654
3140
  if (!this.canWrite()) return;
3141
+ this.showEmojiPanel.set(false);
3142
+ this.showSpecialPanel.set(false);
2655
3143
  this.saveSelection();
2656
3144
  const selected = window.getSelection()?.toString() || "";
2657
3145
  this.linkText.set(selected);
@@ -2664,6 +3152,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2664
3152
  this.bodyEdited.set(true);
2665
3153
  const url = this.normalizedLink();
2666
3154
  this.restoreSelection();
3155
+ this.focusEditor();
2667
3156
  const existing = this.anchorAtSelection();
2668
3157
  if (existing) {
2669
3158
  existing.setAttribute("href", url);
@@ -2695,6 +3184,8 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2695
3184
  }
2696
3185
  openImageDialog() {
2697
3186
  if (!this.canWrite()) return;
3187
+ this.showEmojiPanel.set(false);
3188
+ this.showSpecialPanel.set(false);
2698
3189
  this.saveSelection();
2699
3190
  this.imageUrl.set("");
2700
3191
  this.imageAlt.set("");
@@ -2705,6 +3196,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2705
3196
  if (!this.canWrite() || !this.canInsertImage()) return;
2706
3197
  this.bodyEdited.set(true);
2707
3198
  this.restoreSelection();
3199
+ this.focusEditor();
2708
3200
  const img = document.createElement("img");
2709
3201
  img.setAttribute("src", this.imageUrl().trim());
2710
3202
  img.setAttribute("alt", this.imageAlt() || this.labels.t("emailTemplateEditor.imageAltDefault"));
@@ -2774,7 +3266,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2774
3266
  this.assignmentsTouched.set(true);
2775
3267
  }
2776
3268
  isOpen(id) {
2777
- return id === "v:" + (this.variableGroups()[0]?.name ?? "") !== this.toggledGroups().has(id);
3269
+ return id === "v:" + (this.availableVariableGroups()[0]?.name ?? "") !== this.toggledGroups().has(id);
2778
3270
  }
2779
3271
  toggleGroup(id) {
2780
3272
  this.toggledGroups.update((s) => {
@@ -2788,6 +3280,59 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2788
3280
  if (!this.canWrite()) return;
2789
3281
  this.addBlockHtml(block.html);
2790
3282
  }
3283
+ emojiGroupLabel(key) {
3284
+ switch (key) {
3285
+ case "smileys": return this.labels.t("emailTemplateEditor.emojiGroup.smileys");
3286
+ case "gestures": return this.labels.t("emailTemplateEditor.emojiGroup.gestures");
3287
+ case "hearts": return this.labels.t("emailTemplateEditor.emojiGroup.hearts");
3288
+ case "remembrance": return this.labels.t("emailTemplateEditor.emojiGroup.remembrance");
3289
+ case "pets": return this.labels.t("emailTemplateEditor.emojiGroup.pets");
3290
+ case "nature": return this.labels.t("emailTemplateEditor.emojiGroup.nature");
3291
+ case "food": return this.labels.t("emailTemplateEditor.emojiGroup.food");
3292
+ case "places": return this.labels.t("emailTemplateEditor.emojiGroup.places");
3293
+ case "symbols": return this.labels.t("emailTemplateEditor.emojiGroup.symbols");
3294
+ default: return this.labels.t("emailTemplateEditor.emojiGroup.objects");
3295
+ }
3296
+ }
3297
+ toneLabel(key) {
3298
+ switch (key) {
3299
+ case "light": return this.labels.t("emailTemplateEditor.tone.light");
3300
+ case "mediumLight": return this.labels.t("emailTemplateEditor.tone.mediumLight");
3301
+ case "medium": return this.labels.t("emailTemplateEditor.tone.medium");
3302
+ case "mediumDark": return this.labels.t("emailTemplateEditor.tone.mediumDark");
3303
+ case "dark": return this.labels.t("emailTemplateEditor.tone.dark");
3304
+ default: return this.labels.t("emailTemplateEditor.tone.default");
3305
+ }
3306
+ }
3307
+ emojiWithTone(e) {
3308
+ return withSkinTone(e, this.emojiTone());
3309
+ }
3310
+ emojiName(e) {
3311
+ return `${this.emojiWithTone(e)} ${e.words.split(" ").slice(0, 3).join(" ")}`;
3312
+ }
3313
+ toggleEmojiPanel() {
3314
+ if (!this.canWrite()) return;
3315
+ this.showLinkDialog.set(false);
3316
+ this.showImageDialog.set(false);
3317
+ this.showSpecialPanel.set(false);
3318
+ this.colorPanel.set(null);
3319
+ this.showEmojiPanel.update((v) => !v);
3320
+ }
3321
+ toggleSpecialPanel() {
3322
+ if (!this.canWrite()) return;
3323
+ this.showLinkDialog.set(false);
3324
+ this.showImageDialog.set(false);
3325
+ this.showEmojiPanel.set(false);
3326
+ this.colorPanel.set(null);
3327
+ this.showSpecialPanel.update((v) => !v);
3328
+ }
3329
+ insertEmoji(emoji) {
3330
+ if (!this.canWrite()) return;
3331
+ this.runEditCommand(() => {
3332
+ document.execCommand("insertText", false, emoji);
3333
+ });
3334
+ this.syncBlock();
3335
+ }
2791
3336
  insertVariable(variable) {
2792
3337
  if (!this.canWrite()) return;
2793
3338
  this.runEditCommand(() => {
@@ -2848,6 +3393,13 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2848
3393
  isRequired: false,
2849
3394
  transformFunction: null
2850
3395
  },
3396
+ showSaveHint: {
3397
+ classPropertyName: "showSaveHint",
3398
+ publicName: "showSaveHint",
3399
+ isSignal: true,
3400
+ isRequired: false,
3401
+ transformFunction: null
3402
+ },
2851
3403
  previewBrand: {
2852
3404
  classPropertyName: "previewBrand",
2853
3405
  publicName: "previewBrand",
@@ -3051,26 +3603,40 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3051
3603
  videosRequested: "videosRequested",
3052
3604
  useAsMine: "useAsMine"
3053
3605
  },
3054
- viewQueries: [{
3055
- propertyName: "blockEditors",
3056
- predicate: ["blockEditor"],
3057
- descendants: true,
3058
- isSignal: true
3059
- }, {
3060
- propertyName: "colorInputRef",
3061
- first: true,
3062
- predicate: ["colorInput"],
3063
- descendants: true,
3064
- isSignal: true
3065
- }],
3606
+ viewQueries: [
3607
+ {
3608
+ propertyName: "blockEditors",
3609
+ predicate: ["blockEditor"],
3610
+ descendants: true,
3611
+ isSignal: true
3612
+ },
3613
+ {
3614
+ propertyName: "colorInputRef",
3615
+ first: true,
3616
+ predicate: ["colorInput"],
3617
+ descendants: true,
3618
+ isSignal: true
3619
+ },
3620
+ {
3621
+ propertyName: "highlightInputRef",
3622
+ first: true,
3623
+ predicate: ["highlightInput"],
3624
+ descendants: true,
3625
+ isSignal: true
3626
+ }
3627
+ ],
3066
3628
  ngImport: i0,
3067
3629
  template: `
3068
3630
  <div class="editor-page">
3069
3631
  <!-- Actions (outside the white panels) -->
3070
3632
  <div class="editor-actions">
3071
- @if (heading()) {
3072
- <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
3073
- }
3633
+ <div class="editor-heading-group">
3634
+ <!-- e.g. a back arrow button: content with the editor-heading-start attribute is shown before the heading, on the same row as Save -->
3635
+ <ng-content select="[editor-heading-start]" />
3636
+ @if (heading()) {
3637
+ <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
3638
+ }
3639
+ </div>
3074
3640
  <div class="editor-actions-buttons">
3075
3641
  @if (canWrite() && testSendEnabled()) {
3076
3642
  <ui-button variant="secondary" size="sm" (click)="openTestSendDialog()">
@@ -3081,7 +3647,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3081
3647
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>{{ labels.t('emailTemplateEditor.saveTemplate') }}</ui-button>
3082
3648
  </span>
3083
3649
  </div>
3084
- @if (saveHintVisible(); as hint) {
3650
+ @if (showSaveHint() && saveHintVisible(); as hint) {
3085
3651
  <!-- A blocked Save explains itself in visible text, not only in the tooltip. -->
3086
3652
  <p class="save-hint" role="status" data-testid="save-hint">{{ hint }}</p>
3087
3653
  }
@@ -3128,8 +3694,8 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3128
3694
 
3129
3695
  @if (showActiveRange() && !useAllYear()) {
3130
3696
  <div class="form-row-dates" (focusout)="datesTouched.set(true)">
3131
- <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [(ngModel)]="activeFrom" [disabled]="!canWrite()" />
3132
- <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeFrom()" [error]="datesError()" />
3697
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [ngModel]="activeFrom()" (ngModelChange)="onActiveFromChange($event)" [disabled]="!canWrite()" [min]="today" />
3698
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeToMin()" [error]="datesError()" />
3133
3699
  </div>
3134
3700
  }
3135
3701
 
@@ -3145,6 +3711,9 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3145
3711
  }
3146
3712
  <div class="assignment-list" [hidden]="filteredAssignments().length === 0" (focusout)="onAssignmentsFocusOut($event)">
3147
3713
  @for (item of filteredAssignments(); track item.key) {
3714
+ @if (item.groupStart) {
3715
+ <div class="assignment-group" data-testid="assignment-group">{{ item.group }}</div>
3716
+ }
3148
3717
  <div class="assignment-item" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
3149
3718
  [attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
3150
3719
  (click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
@@ -3177,78 +3746,124 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3177
3746
 
3178
3747
  @if (activeEditorTab() === 'edit') {
3179
3748
  @if (canWrite()) {
3180
- <!-- Toolbar row 1: mousedown preventDefault keeps focus (and the selection) in the editor -->
3749
+ <!-- Toolbar (the last group is the block spacing): mousedown preventDefault keeps focus (and the selection) in the editor -->
3181
3750
  <div class="editor-toolbar" role="toolbar" [attr.aria-label]="labels.t('emailTemplateEditor.textFormatting')" (mousedown)="preventFocusLoss($event)">
3182
3751
  <div class="toolbar-group">
3183
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
3184
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
3185
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
3186
- </div>
3187
- <div class="toolbar-group">
3188
- @for (k of [headingKey()]; track k) {
3189
- <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" ngModel="p"
3190
- (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
3191
- }
3752
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.undo')" (click)="execCommand('undo')">
3753
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
3754
+ </ui-button>
3755
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.redo')" (click)="execCommand('redo')">
3756
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
3757
+ </ui-button>
3192
3758
  </div>
3193
3759
  <div class="toolbar-group">
3760
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" [ngModel]="headingValue()"
3761
+ (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
3194
3762
  @for (k of [sizeKey()]; track k) {
3195
3763
  <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.fontSize')" [placeholder]="labels.t('emailTemplateEditor.size')" [options]="fontSizeOptions" ngModel=""
3196
3764
  (mousedown)="saveSelection()" (ngModelChange)="onFontSize($event)" />
3197
3765
  }
3198
3766
  </div>
3199
3767
  <div class="toolbar-group">
3200
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignLeft')" (click)="execCommand('justifyLeft')">
3201
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
3202
- </ui-button>
3203
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignCenter')" (click)="execCommand('justifyCenter')">
3204
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
3205
- </ui-button>
3206
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignRight')" (click)="execCommand('justifyRight')">
3207
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
3768
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
3769
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
3770
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
3771
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.strikethrough')" [uiTooltip]="labels.t('emailTemplateEditor.strikethrough')" (click)="execCommand('strikeThrough')">
3772
+ <s>S</s>
3208
3773
  </ui-button>
3209
- </div>
3210
- <div class="toolbar-group">
3211
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipBulletedList')" (click)="execCommand('insertUnorderedList')">
3212
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
3774
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.subscript')" [uiTooltip]="labels.t('emailTemplateEditor.subscript')" (click)="execCommand('subscript')">
3775
+ <span class="tb-sub">x<sub>2</sub></span>
3213
3776
  </ui-button>
3214
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipNumberedList')" (click)="execCommand('insertOrderedList')">
3215
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
3777
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.superscript')" [uiTooltip]="labels.t('emailTemplateEditor.superscript')" (click)="execCommand('superscript')">
3778
+ <span class="tb-sub">x<sup>2</sup></span>
3216
3779
  </ui-button>
3217
3780
  </div>
3218
3781
  <div class="toolbar-group">
3219
- <!-- The browser's own colour dialog is the picker; a button opens it so the toolbar keeps one look. -->
3782
+ <!-- The browser's own colour dialogs are the pickers; a button opens each so the toolbar keeps one look. -->
3220
3783
  <input #colorInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.textColor')" tabindex="-1" [value]="currentColor()" (change)="applyTextColor($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
3221
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" (mousedown)="openColorPicker()">
3784
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" data-testid="text-color-button" [attr.aria-expanded]="colorPanel() === 'text'" (mousedown)="saveSelection()" (click)="toggleColorPanel('text')">
3222
3785
  <span class="color-indicator">
3223
3786
  <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><text y="20" font-size="20" font-weight="700">A</text></svg>
3224
3787
  <span class="color-bar" [style.background]="currentColor()"></span>
3225
3788
  </span>
3226
3789
  </ui-button>
3790
+ <input #highlightInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.highlightColor')" tabindex="-1" [value]="currentHighlight()" (change)="applyHighlight($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
3791
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.highlightColor')" [uiTooltip]="labels.t('emailTemplateEditor.highlightColor')" data-testid="highlight-color-button" [attr.aria-expanded]="colorPanel() === 'highlight'" (mousedown)="saveSelection()" (click)="toggleColorPanel('highlight')">
3792
+ <span class="color-indicator">
3793
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 11l-6 6v3h9l3-3"/><path d="M22 12l-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>
3794
+ <span class="color-bar" [style.background]="currentHighlight()"></span>
3795
+ </span>
3796
+ </ui-button>
3227
3797
  </div>
3228
3798
  <div class="toolbar-group">
3229
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
3230
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
3799
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.alignLeft')" (click)="execCommand('justifyLeft')">
3800
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
3231
3801
  </ui-button>
3232
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
3233
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
3802
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.alignCenter')" (click)="execCommand('justifyCenter')">
3803
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
3804
+ </ui-button>
3805
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.alignRight')" (click)="execCommand('justifyRight')">
3806
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
3807
+ </ui-button>
3808
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignJustify')" [uiTooltip]="labels.t('emailTemplateEditor.alignJustify')" (click)="execCommand('justifyFull')">
3809
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="3" y2="18"/></svg>
3234
3810
  </ui-button>
3235
3811
  </div>
3236
3812
  <div class="toolbar-group">
3237
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.tipUndo')" (click)="execCommand('undo')">
3238
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
3813
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.bulletedList')" (click)="execCommand('insertUnorderedList')">
3814
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
3815
+ </ui-button>
3816
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.numberedList')" (click)="execCommand('insertOrderedList')">
3817
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
3239
3818
  </ui-button>
3240
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.tipRedo')" (click)="execCommand('redo')">
3241
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
3819
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.outdent')" [uiTooltip]="labels.t('emailTemplateEditor.outdent')" (click)="execCommand('outdent')">
3820
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="7 8 3 12 7 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/></svg>
3821
+ </ui-button>
3822
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.indent')" [uiTooltip]="labels.t('emailTemplateEditor.indent')" (click)="execCommand('indent')">
3823
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 8 7 12 3 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/></svg>
3242
3824
  </ui-button>
3243
3825
  </div>
3244
- </div>
3245
-
3246
- <!-- Toolbar row 2: block spacing -->
3247
- <div class="toolbar-row-2">
3248
- <div class="toolbar-group" (mousedown)="preventFocusLoss($event)">
3249
- <span class="toolbar-label" id="tpl-spacing-label">{{ labels.t('emailTemplateEditor.blockSpacing') }}</span>
3250
- <ui-pill-tabs [tabs]="spacingTabs" [activeKey]="blockSpacing() || 'none'" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" (tabChange)="applySpacing($event === 'none' ? '' : $event)" />
3826
+ <div class="toolbar-group">
3827
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.insertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
3828
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
3829
+ </ui-button>
3830
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.insertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
3831
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
3832
+ </ui-button>
3833
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertTable')" [uiTooltip]="labels.t('emailTemplateEditor.insertTable')" (mousedown)="saveSelection()" (click)="insertTable()">
3834
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>
3835
+ </ui-button>
3836
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.blockQuote')" [uiTooltip]="labels.t('emailTemplateEditor.blockQuote')" data-testid="quote-button" (click)="toggleQuote()">
3837
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 21c3 0 7-1 7-8V5H3v8h4c0 3-2 4-4 4zm11 0c3 0 7-1 7-8V5h-7v8h4c0 3-2 4-4 4z"/></svg>
3838
+ </ui-button>
3839
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.horizontalLine')" [uiTooltip]="labels.t('emailTemplateEditor.horizontalLine')" (click)="execCommand('insertHorizontalRule')">
3840
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="3" y1="12" x2="21" y2="12"/></svg>
3841
+ </ui-button>
3842
+ </div>
3843
+ <div class="toolbar-group">
3844
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emoji')" [uiTooltip]="labels.t('emailTemplateEditor.tipEmoji')" data-testid="emoji-button" (mousedown)="saveSelection()" (click)="toggleEmojiPanel()">
3845
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>
3846
+ </ui-button>
3847
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.specialCharacters')" [uiTooltip]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-button" (mousedown)="saveSelection()" (click)="toggleSpecialPanel()">
3848
+ <span class="tb-sub">ฮฉ</span>
3849
+ </ui-button>
3850
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.clearFormatting')" [uiTooltip]="labels.t('emailTemplateEditor.clearFormatting')" (click)="execCommand('removeFormat')">
3851
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/><line x1="3" y1="3" x2="21" y2="21"/></svg>
3852
+ </ui-button>
3853
+ </div>
3854
+ <div class="toolbar-group">
3855
+ <ui-select class="toolbar-select" size="sm" data-testid="spacing-select" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" [uiTooltip]="labels.t('emailTemplateEditor.blockSpacing')" [options]="spacingOptions" [ngModel]="blockSpacing() || 'none'"
3856
+ (mousedown)="saveSelection()" (ngModelChange)="applySpacing($event === 'none' ? '' : $event)" />
3251
3857
  </div>
3858
+ @if (inTable()) {
3859
+ <div class="toolbar-group" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.tableTools')" data-testid="table-tools">
3860
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableAddRow')" [uiTooltip]="labels.t('emailTemplateEditor.tableAddRow')" (click)="tableAddRow()"><span class="tb-sub">+ โ†“</span></ui-button>
3861
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableAddColumn')" [uiTooltip]="labels.t('emailTemplateEditor.tableAddColumn')" (click)="tableAddColumn()"><span class="tb-sub">+ โ†’</span></ui-button>
3862
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDeleteRow')" [uiTooltip]="labels.t('emailTemplateEditor.tableDeleteRow')" (click)="tableDeleteRow()"><span class="tb-sub">โˆ’ โ†“</span></ui-button>
3863
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDeleteColumn')" [uiTooltip]="labels.t('emailTemplateEditor.tableDeleteColumn')" (click)="tableDeleteColumn()"><span class="tb-sub">โˆ’ โ†’</span></ui-button>
3864
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDelete')" [uiTooltip]="labels.t('emailTemplateEditor.tableDelete')" (click)="tableDelete()"><span class="tb-sub">โœ•</span></ui-button>
3865
+ </div>
3866
+ }
3252
3867
  </div>
3253
3868
  }
3254
3869
 
@@ -3257,9 +3872,9 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3257
3872
  <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertLink')">
3258
3873
  <div class="link-dialog-inner">
3259
3874
  <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertLink2') }}</span>
3260
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink()" />
3875
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink(); $event.preventDefault()" />
3261
3876
  @if (!linkTextFromSelection()) {
3262
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink()" />
3877
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink(); $event.preventDefault()" />
3263
3878
  }
3264
3879
  <div class="link-dialog-actions">
3265
3880
  <ui-button variant="secondary" size="sm" (click)="showLinkDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
@@ -3269,6 +3884,63 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3269
3884
  </div>
3270
3885
  }
3271
3886
 
3887
+ <!-- Colour picker (inline panel, for the text colour and the highlight): a grid of ready colours, a custom colour (the browser's own dialog) and Remove -->
3888
+ @if (canWrite() && colorPanel(); as which) {
3889
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)">
3890
+ <div class="emoji-panel-head">
3891
+ <span class="link-dialog-title">{{ labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor') }}</span>
3892
+ <ui-button variant="secondary" size="sm" data-testid="color-remove" (click)="removeColor(which)">{{ labels.t('emailTemplateEditor.removeColor') }}</ui-button>
3893
+ <ui-button variant="secondary" size="sm" data-testid="color-custom" (click)="openCustomColor(which)">{{ labels.t('emailTemplateEditor.customColor') }}</ui-button>
3894
+ <ui-button variant="secondary" size="sm" (click)="colorPanel.set(null)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
3895
+ </div>
3896
+ <div class="color-grid" data-testid="color-grid">
3897
+ @for (c of colorSwatches; track c) {
3898
+ <button type="button" class="color-swatch" [style.background]="c" [attr.aria-label]="c" [attr.title]="c" [class.selected]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" (click)="pickColor(which, c)"></button>
3899
+ }
3900
+ </div>
3901
+ </div>
3902
+ }
3903
+
3904
+ <!-- Emoji picker (inline popover): a search box, category tabs and a skin tone; a click inserts the emoji at the caret and the panel stays open for more -->
3905
+ @if (canWrite() && showEmojiPanel()) {
3906
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)">
3907
+ <div class="emoji-panel-head">
3908
+ <ui-text-input class="emoji-search" [ariaLabel]="labels.t('emailTemplateEditor.emojiSearch')" [placeholder]="labels.t('emailTemplateEditor.emojiSearch')" [(ngModel)]="emojiSearch" (mousedown)="saveSelection()" />
3909
+ <ui-select class="emoji-tone" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emojiSkinTone')" [options]="skinToneOptions()" [(ngModel)]="emojiTone" (mousedown)="saveSelection()" />
3910
+ <ui-button variant="secondary" size="sm" (click)="showEmojiPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
3911
+ </div>
3912
+ @if (!emojiSearch().trim()) {
3913
+ <div class="emoji-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')">
3914
+ @for (g of emojiGroupKeys; track g.key) {
3915
+ <button type="button" role="tab" class="emoji-tab" [class.active]="emojiGroup() === g.key" [attr.aria-selected]="emojiGroup() === g.key" [attr.aria-label]="emojiGroupLabel(g.key)" [attr.title]="emojiGroupLabel(g.key)" (click)="emojiGroup.set(g.key)">{{ g.icon }}</button>
3916
+ }
3917
+ </div>
3918
+ }
3919
+ <div class="emoji-grid" data-testid="emoji-grid">
3920
+ @for (e of shownEmojis(); track e.char) {
3921
+ <button type="button" class="emoji-btn" [attr.aria-label]="emojiName(e)" [attr.title]="e.words.split(' ').slice(0, 3).join(' ')" (click)="insertEmoji(emojiWithTone(e))">{{ emojiWithTone(e) }}</button>
3922
+ } @empty {
3923
+ <span class="emoji-empty">{{ labels.t('emailTemplateEditor.emojiNoResults') }}</span>
3924
+ }
3925
+ </div>
3926
+ </div>
3927
+ }
3928
+
3929
+ <!-- Special characters (inline popover) -->
3930
+ @if (canWrite() && showSpecialPanel()) {
3931
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)">
3932
+ <div class="emoji-panel-head">
3933
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.specialCharactersTitle') }}</span>
3934
+ <ui-button variant="secondary" size="sm" (click)="showSpecialPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
3935
+ </div>
3936
+ <div class="emoji-grid">
3937
+ @for (c of specialCharacters; track c) {
3938
+ <button type="button" class="emoji-btn special-btn" [attr.aria-label]="c" (click)="insertEmoji(c)">{{ c }}</button>
3939
+ }
3940
+ </div>
3941
+ </div>
3942
+ }
3943
+
3272
3944
  <!-- Image URL dialog -->
3273
3945
  @if (canWrite() && showImageDialog()) {
3274
3946
  <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertImage')">
@@ -3279,8 +3951,8 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3279
3951
  <ui-button variant="secondary" size="sm" [loading]="imageUploading()" (click)="imageFile.click()">{{ imageUploading() ? labels.t('emailTemplateEditor.uploadingImage') : labels.t('emailTemplateEditor.uploadImage') }}</ui-button>
3280
3952
  <ui-error [errorId]="idPrefix() + '-image-upload-error'" [message]="imageUploadError()" />
3281
3953
  }
3282
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl()" />
3283
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl()" />
3954
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl(); $event.preventDefault()" />
3955
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl(); $event.preventDefault()" />
3284
3956
  <div class="link-dialog-actions">
3285
3957
  <ui-button variant="secondary" size="sm" (click)="showImageDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
3286
3958
  <ui-button variant="primary" size="sm" [disabled]="!canInsertImage()" (click)="insertImageFromUrl()">{{ labels.t('common.insert') }}</ui-button>
@@ -3301,57 +3973,17 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3301
3973
  </ui-alert>
3302
3974
  }
3303
3975
 
3304
- <!-- Block Canvas with DnD -->
3305
- <div class="blocks-canvas" (dragover)="onCanvasDragOver($event)" (drop)="onDropZoneDrop($event, blocks().length)" (focusout)="onBodyFocusOut($event)">
3306
- <!-- Initial drop zone (before first block) -->
3307
- <div class="drop-zone" [class.active]="dragOverIndex() === 0" (dragover)="onDropZoneDragOver($event, 0)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, 0)">
3308
- <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3309
- </div>
3310
-
3311
- @for (block of blocks(); track block.id; let i = $index) {
3312
- <div class="block-wrapper" #blockWrapper [class.selected]="selectedBlockId() === block.id" [class.dragging]="dragFromCanvas() === i" (dragend)="onBlockDragEnd()">
3313
- @if (canWrite()) {
3314
- <!-- Only the handle is draggable: a draggable ancestor of the contenteditable breaks text selection in Firefox / Safari. Move up / down below are the keyboard and touch alternative. -->
3315
- <div class="block-drag-handle" [attr.title]="labels.t('emailTemplateEditor.dragToReorder')" draggable="true" (dragstart)="onBlockDragStart($event, i, blockWrapper)">
3316
- <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
3317
- </div>
3318
- }
3319
-
3320
- <!-- Block content (contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps) -->
3321
- <div #blockEditor class="block-content" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.emailBlockN', { n: i + 1 })"
3322
- [attr.data-block-id]="block.id" [attr.data-placeholder]="i === 0 ? startPlaceholder() : labels.t('emailTemplateEditor.clickToEdit')" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
3323
- (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (click)="selectedBlockId.set(block.id)"></div>
3324
-
3325
- @if (canWrite()) {
3326
- <div class="block-controls">
3327
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockUp')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveUp')" [disabled]="i === 0" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, -1)">
3328
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M18 15l-6-6-6 6"/></svg>
3329
- </ui-button>
3330
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockDown')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveDown')" [disabled]="i === blocks().length - 1" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, 1)">
3331
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
3332
- </ui-button>
3333
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.duplicateBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDuplicate')" (mousedown)="preventFocusLoss($event)" (click)="duplicateBlock(i)">
3334
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
3335
- </ui-button>
3336
- @if (blocks().length > 1) {
3337
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.deleteBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDeleteBlock')" (mousedown)="preventFocusLoss($event)" (click)="deleteBlock(i)">
3338
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>
3339
- </ui-button>
3340
- }
3341
- </div>
3342
- }
3343
- </div>
3344
-
3345
- <!-- Drop zone after each block -->
3346
- <div class="drop-zone" [class.active]="dragOverIndex() === i + 1" (dragover)="onDropZoneDragOver($event, i + 1)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, i + 1)">
3347
- <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
3976
+ <!-- The document: ONE editing surface, like a word processor. The page is as wide as a sent email's card (600px) with the same 28px side padding, so the text wraps as it does in an inbox. -->
3977
+ <div class="blocks-canvas" [style.font-family]="canvasFont()" (focusout)="onBodyFocusOut($event)">
3978
+ @for (block of blocks(); track block.id) {
3979
+ <div class="block-wrapper">
3980
+ <!-- contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps -->
3981
+ <div #blockEditor class="block-content tpl-doc" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.documentLabel')"
3982
+ [attr.data-block-id]="block.id" [attr.data-placeholder]="startPlaceholder()" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
3983
+ (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (keyup)="refreshContext()" (mouseup)="refreshContext()" (keydown.enter)="onDocEnter($event)"
3984
+ (dragover)="onDocDragOver($event)" (drop)="onDocDrop($event)"></div>
3348
3985
  </div>
3349
3986
  }
3350
-
3351
- @if (canWrite()) {
3352
- <button type="button" class="add-block-btn" (click)="addBlock('text-block')">
3353
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>{{ labels.t('emailTemplateEditor.addBlock') }}</button>
3354
- }
3355
3987
  </div>
3356
3988
  }
3357
3989
 
@@ -3426,9 +4058,12 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3426
4058
  @if (activeRightTab() === 'variables') {
3427
4059
  <div class="right-panel-body">
3428
4060
  <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.templateVariables') }}</h4>
3429
- <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
3430
-
3431
- @for (group of variableGroups(); track group.name) {
4061
+ @if (variablesNeedAssignment()) {
4062
+ <p class="right-section-desc" role="status" data-testid="variables-need-assignment">{{ labels.t('emailTemplateEditor.assignToSeeVariables') }}</p>
4063
+ } @else {
4064
+ <p class="right-section-desc" data-testid="variables-click-hint">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
4065
+ }
4066
+ @for (group of availableVariableGroups(); track group.name) {
3432
4067
  <div class="block-group">
3433
4068
  <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('v:' + group.name)" (click)="toggleGroup('v:' + group.name)">
3434
4069
  <svg class="chevron" [class.expanded]="isOpen('v:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
@@ -3532,7 +4167,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3532
4167
 
3533
4168
  `,
3534
4169
  isInline: true,
3535
- styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}.email-checks{margin:8px 12px 0}.email-checks-list{margin:0;padding-left:18px}.hidden-file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.add-block-btn:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-row-2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 20px;background:#fff;border-bottom:1px solid #e2e8f0}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:600px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-wrapper{flex-shrink:0;position:relative;display:flex;align-items:flex-start;background:#fff;border:2px solid transparent;border-radius:8px;transition:border-color .15s,box-shadow .15s}.block-wrapper:hover,.block-wrapper.selected,.block-wrapper:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.block-wrapper:hover .block-drag-handle,.block-wrapper.selected .block-drag-handle,.block-wrapper:focus-within .block-drag-handle{opacity:1}.block-wrapper:hover .block-controls,.block-wrapper.selected .block-controls,.block-wrapper:focus-within .block-controls{opacity:1;pointer-events:all}.block-wrapper.dragging{opacity:.4}.block-drag-handle{flex-shrink:0;width:28px;display:flex;align-items:flex-start;justify-content:center;padding-top:14px;opacity:0;transition:opacity .15s;cursor:grab;color:#94a3b8}.block-drag-handle:active{cursor:grabbing}.block-content{flex:1;min-width:0;padding:12px 16px;outline:none;font-size:.9375rem;color:#1e293b;line-height:1.6;min-height:48px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}.block-content p{margin:0 0 8px}.block-content p:last-child{margin:0}.block-content h1,.block-content h2,.block-content h3{margin:8px 0 6px;color:#1e293b}.block-content a{color:#3b82f6}.block-content img{max-width:100%;border-radius:6px}.block-content ul,.block-content ol{padding-left:20px;margin:0 0 8px}.block-controls{position:absolute;top:0;left:-48px;flex-direction:column;display:flex;gap:2px;opacity:0;pointer-events:none;transition:opacity .15s;background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:3px;box-shadow:0 2px 6px #00000014}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}@media(hover:none){.block-wrapper.selected .block-controls{opacity:1;pointer-events:all}}.drop-zone{flex-shrink:0;height:8px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:height .15s,background .15s;position:relative}.drop-zone-label{font-size:.75rem;font-weight:600;color:#1d4ed8;opacity:0;transition:opacity .1s}.drop-zone.active{height:40px;background:#3b82f614;border:2px dashed #3b82f6}.drop-zone.active .drop-zone-label{opacity:1}.add-block-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;padding:12px;margin-top:8px;border:2px dashed #e2e8f0;border-radius:8px;background:none;font-size:.875rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:border-color .15s,color .15s,background .15s}.add-block-btn:hover{border-color:#3b82f6;color:#3b82f6;background:#3b82f60a}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.toolbar-row-2,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"],
4170
+ styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading-group{display:flex;align-items:center;gap:4px;min-width:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto;overflow-x:hidden}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}.form-row-dates>*{min-width:0}.email-checks{margin:8px 12px 0}.email-checks-list{margin:0;padding-left:18px}.hidden-file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-group{position:sticky;top:0;z-index:1;padding:8px 14px;background:#f8fafc;border-bottom:1px solid #e2e8f0;font-size:.6875rem;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.04em}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.emoji-panel-head{display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap}.emoji-search{display:block;flex:1 1 200px;min-width:160px}.emoji-tone{display:block;min-width:120px}.emoji-tabs{display:flex;gap:2px;border-bottom:1px solid #e2e8f0;margin-bottom:8px;overflow-x:auto}.emoji-tab{flex:0 0 auto;width:40px;height:36px;border:0;border-bottom:2px solid transparent;background:transparent;font-size:18px;cursor:pointer;font-family:\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Noto Color Emoji\",sans-serif}.emoji-tab.active{border-bottom-color:#3b82f6;background:#eff6ff}.color-grid{display:grid;grid-template-columns:repeat(10,28px);gap:4px}.color-swatch{width:28px;height:28px;border-radius:6px;border:1px solid rgba(0,0,0,.15);cursor:pointer;padding:0}.color-swatch:hover{transform:scale(1.1)}.color-swatch:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.color-swatch.selected{outline:2px solid #1e293b;outline-offset:1px}.emoji-grid{display:flex;flex-wrap:wrap;gap:2px;max-height:220px;overflow-y:auto}.emoji-empty{font-size:.8125rem;color:#64748b;padding:8px 4px}.emoji-btn{width:36px;height:36px;padding:0;border:0;border-radius:6px;background:transparent;font-size:20px;line-height:1;cursor:pointer;font-family:\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Noto Color Emoji\",sans-serif}.emoji-btn.special-btn{font-family:inherit;font-size:16px}.emoji-btn:hover,.emoji-btn:focus-visible{background:#f1f5f9}.tb-sub{font-size:12px;font-weight:700;line-height:1}@media(pointer:coarse){.emoji-btn{width:44px;height:44px}}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:602px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.block-wrapper{flex-shrink:0;width:100%;max-width:602px;margin:0 auto;box-sizing:border-box;padding:24px 28px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-content{min-width:0;padding:0;outline:none;font-size:15px;color:#1e293b;line-height:1.6;min-height:320px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"],
3536
4171
  dependencies: [
3537
4172
  {
3538
4173
  kind: "ngmodule",
@@ -3689,23 +4324,6 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
3689
4324
  selector: "ui-error",
3690
4325
  inputs: ["message", "errorId"]
3691
4326
  },
3692
- {
3693
- kind: "component",
3694
- type: PillTabsComponent,
3695
- selector: "ui-pill-tabs",
3696
- inputs: [
3697
- "tabs",
3698
- "activeKey",
3699
- "ariaLabel",
3700
- "name",
3701
- "noWrap",
3702
- "orientation",
3703
- "controlsPanels",
3704
- "showDescription",
3705
- "headingLevel"
3706
- ],
3707
- outputs: ["tabChange"]
3708
- },
3709
4327
  {
3710
4328
  kind: "component",
3711
4329
  type: RadioGroupComponent,
@@ -3875,7 +4493,6 @@ i0.ษตษตngDeclareClassMetadata({
3875
4493
  DividerComponent,
3876
4494
  EmptyStateComponent,
3877
4495
  ErrorComponent,
3878
- PillTabsComponent,
3879
4496
  RadioGroupComponent,
3880
4497
  SearchInputComponent,
3881
4498
  SelectComponent,
@@ -3888,9 +4505,13 @@ i0.ษตษตngDeclareClassMetadata({
3888
4505
  <div class="editor-page">
3889
4506
  <!-- Actions (outside the white panels) -->
3890
4507
  <div class="editor-actions">
3891
- @if (heading()) {
3892
- <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
3893
- }
4508
+ <div class="editor-heading-group">
4509
+ <!-- e.g. a back arrow button: content with the editor-heading-start attribute is shown before the heading, on the same row as Save -->
4510
+ <ng-content select="[editor-heading-start]" />
4511
+ @if (heading()) {
4512
+ <h2 class="editor-heading" data-testid="editor-heading">{{ heading() }}</h2>
4513
+ }
4514
+ </div>
3894
4515
  <div class="editor-actions-buttons">
3895
4516
  @if (canWrite() && testSendEnabled()) {
3896
4517
  <ui-button variant="secondary" size="sm" (click)="openTestSendDialog()">
@@ -3901,7 +4522,7 @@ i0.ษตษตngDeclareClassMetadata({
3901
4522
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>{{ labels.t('emailTemplateEditor.saveTemplate') }}</ui-button>
3902
4523
  </span>
3903
4524
  </div>
3904
- @if (saveHintVisible(); as hint) {
4525
+ @if (showSaveHint() && saveHintVisible(); as hint) {
3905
4526
  <!-- A blocked Save explains itself in visible text, not only in the tooltip. -->
3906
4527
  <p class="save-hint" role="status" data-testid="save-hint">{{ hint }}</p>
3907
4528
  }
@@ -3948,8 +4569,8 @@ i0.ษตษตngDeclareClassMetadata({
3948
4569
 
3949
4570
  @if (showActiveRange() && !useAllYear()) {
3950
4571
  <div class="form-row-dates" (focusout)="datesTouched.set(true)">
3951
- <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [(ngModel)]="activeFrom" [disabled]="!canWrite()" />
3952
- <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeFrom()" [error]="datesError()" />
4572
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeFrom')" [ngModel]="activeFrom()" (ngModelChange)="onActiveFromChange($event)" [disabled]="!canWrite()" [min]="today" />
4573
+ <ui-date-input [label]="labels.t('emailTemplateEditor.activeTo')" [(ngModel)]="activeTo" [disabled]="!canWrite()" [min]="activeToMin()" [error]="datesError()" />
3953
4574
  </div>
3954
4575
  }
3955
4576
 
@@ -3965,6 +4586,9 @@ i0.ษตษตngDeclareClassMetadata({
3965
4586
  }
3966
4587
  <div class="assignment-list" [hidden]="filteredAssignments().length === 0" (focusout)="onAssignmentsFocusOut($event)">
3967
4588
  @for (item of filteredAssignments(); track item.key) {
4589
+ @if (item.groupStart) {
4590
+ <div class="assignment-group" data-testid="assignment-group">{{ item.group }}</div>
4591
+ }
3968
4592
  <div class="assignment-item" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
3969
4593
  [attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
3970
4594
  (click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
@@ -3997,78 +4621,124 @@ i0.ษตษตngDeclareClassMetadata({
3997
4621
 
3998
4622
  @if (activeEditorTab() === 'edit') {
3999
4623
  @if (canWrite()) {
4000
- <!-- Toolbar row 1: mousedown preventDefault keeps focus (and the selection) in the editor -->
4624
+ <!-- Toolbar (the last group is the block spacing): mousedown preventDefault keeps focus (and the selection) in the editor -->
4001
4625
  <div class="editor-toolbar" role="toolbar" [attr.aria-label]="labels.t('emailTemplateEditor.textFormatting')" (mousedown)="preventFocusLoss($event)">
4002
4626
  <div class="toolbar-group">
4003
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
4004
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
4005
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
4006
- </div>
4007
- <div class="toolbar-group">
4008
- @for (k of [headingKey()]; track k) {
4009
- <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" ngModel="p"
4010
- (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
4011
- }
4627
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.undo')" (click)="execCommand('undo')">
4628
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
4629
+ </ui-button>
4630
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.redo')" (click)="execCommand('redo')">
4631
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
4632
+ </ui-button>
4012
4633
  </div>
4013
4634
  <div class="toolbar-group">
4635
+ <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.headingLevel')" [options]="headingOptions" [ngModel]="headingValue()"
4636
+ (mousedown)="saveSelection()" (ngModelChange)="onHeading($event)" />
4014
4637
  @for (k of [sizeKey()]; track k) {
4015
4638
  <ui-select class="toolbar-select" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.fontSize')" [placeholder]="labels.t('emailTemplateEditor.size')" [options]="fontSizeOptions" ngModel=""
4016
4639
  (mousedown)="saveSelection()" (ngModelChange)="onFontSize($event)" />
4017
4640
  }
4018
4641
  </div>
4019
4642
  <div class="toolbar-group">
4020
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignLeft')" (click)="execCommand('justifyLeft')">
4021
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
4022
- </ui-button>
4023
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignCenter')" (click)="execCommand('justifyCenter')">
4024
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
4025
- </ui-button>
4026
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.tipAlignRight')" (click)="execCommand('justifyRight')">
4027
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
4643
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bold')" [uiTooltip]="labels.t('emailTemplateEditor.tipBold')" (click)="execCommand('bold')"><strong>B</strong></ui-button>
4644
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.italic')" [uiTooltip]="labels.t('emailTemplateEditor.tipItalic')" (click)="execCommand('italic')"><em>I</em></ui-button>
4645
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.underline')" [uiTooltip]="labels.t('emailTemplateEditor.tipUnderline')" (click)="execCommand('underline')"><u>U</u></ui-button>
4646
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.strikethrough')" [uiTooltip]="labels.t('emailTemplateEditor.strikethrough')" (click)="execCommand('strikeThrough')">
4647
+ <s>S</s>
4028
4648
  </ui-button>
4029
- </div>
4030
- <div class="toolbar-group">
4031
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipBulletedList')" (click)="execCommand('insertUnorderedList')">
4032
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
4649
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.subscript')" [uiTooltip]="labels.t('emailTemplateEditor.subscript')" (click)="execCommand('subscript')">
4650
+ <span class="tb-sub">x<sub>2</sub></span>
4033
4651
  </ui-button>
4034
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.tipNumberedList')" (click)="execCommand('insertOrderedList')">
4035
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
4652
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.superscript')" [uiTooltip]="labels.t('emailTemplateEditor.superscript')" (click)="execCommand('superscript')">
4653
+ <span class="tb-sub">x<sup>2</sup></span>
4036
4654
  </ui-button>
4037
4655
  </div>
4038
4656
  <div class="toolbar-group">
4039
- <!-- The browser's own colour dialog is the picker; a button opens it so the toolbar keeps one look. -->
4657
+ <!-- The browser's own colour dialogs are the pickers; a button opens each so the toolbar keeps one look. -->
4040
4658
  <input #colorInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.textColor')" tabindex="-1" [value]="currentColor()" (change)="applyTextColor($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
4041
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" (mousedown)="openColorPicker()">
4659
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.textColor')" [uiTooltip]="labels.t('emailTemplateEditor.tipTextColor')" data-testid="text-color-button" [attr.aria-expanded]="colorPanel() === 'text'" (mousedown)="saveSelection()" (click)="toggleColorPanel('text')">
4042
4660
  <span class="color-indicator">
4043
4661
  <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><text y="20" font-size="20" font-weight="700">A</text></svg>
4044
4662
  <span class="color-bar" [style.background]="currentColor()"></span>
4045
4663
  </span>
4046
4664
  </ui-button>
4665
+ <input #highlightInput type="color" class="hidden-color-input" [attr.aria-label]="labels.t('emailTemplateEditor.highlightColor')" tabindex="-1" [value]="currentHighlight()" (change)="applyHighlight($any($event.target).value)" (mousedown)="$event.stopPropagation()" />
4666
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.highlightColor')" [uiTooltip]="labels.t('emailTemplateEditor.highlightColor')" data-testid="highlight-color-button" [attr.aria-expanded]="colorPanel() === 'highlight'" (mousedown)="saveSelection()" (click)="toggleColorPanel('highlight')">
4667
+ <span class="color-indicator">
4668
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 11l-6 6v3h9l3-3"/><path d="M22 12l-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>
4669
+ <span class="color-bar" [style.background]="currentHighlight()"></span>
4670
+ </span>
4671
+ </ui-button>
4047
4672
  </div>
4048
4673
  <div class="toolbar-group">
4049
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
4050
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
4674
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignLeft')" [uiTooltip]="labels.t('emailTemplateEditor.alignLeft')" (click)="execCommand('justifyLeft')">
4675
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>
4676
+ </ui-button>
4677
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignCenter')" [uiTooltip]="labels.t('emailTemplateEditor.alignCenter')" (click)="execCommand('justifyCenter')">
4678
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>
4679
+ </ui-button>
4680
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignRight')" [uiTooltip]="labels.t('emailTemplateEditor.alignRight')" (click)="execCommand('justifyRight')">
4681
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>
4051
4682
  </ui-button>
4052
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.tipInsertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
4053
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
4683
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.alignJustify')" [uiTooltip]="labels.t('emailTemplateEditor.alignJustify')" (click)="execCommand('justifyFull')">
4684
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="3" y2="18"/></svg>
4054
4685
  </ui-button>
4055
4686
  </div>
4056
4687
  <div class="toolbar-group">
4057
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.undo')" [uiTooltip]="labels.t('emailTemplateEditor.tipUndo')" (click)="execCommand('undo')">
4058
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6.69 3L3 13"/></svg>
4688
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.bulletedList')" [uiTooltip]="labels.t('emailTemplateEditor.bulletedList')" (click)="execCommand('insertUnorderedList')">
4689
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
4059
4690
  </ui-button>
4060
- <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.redo')" [uiTooltip]="labels.t('emailTemplateEditor.tipRedo')" (click)="execCommand('redo')">
4061
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6.69 3L21 13"/></svg>
4691
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.numberedList')" [uiTooltip]="labels.t('emailTemplateEditor.numberedList')" (click)="execCommand('insertOrderedList')">
4692
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>
4693
+ </ui-button>
4694
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.outdent')" [uiTooltip]="labels.t('emailTemplateEditor.outdent')" (click)="execCommand('outdent')">
4695
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="7 8 3 12 7 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/></svg>
4696
+ </ui-button>
4697
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.indent')" [uiTooltip]="labels.t('emailTemplateEditor.indent')" (click)="execCommand('indent')">
4698
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 8 7 12 3 16"/><line x1="21" y1="12" x2="11" y2="12"/><line x1="21" y1="6" x2="11" y2="6"/><line x1="21" y1="18" x2="11" y2="18"/></svg>
4062
4699
  </ui-button>
4063
4700
  </div>
4064
- </div>
4065
-
4066
- <!-- Toolbar row 2: block spacing -->
4067
- <div class="toolbar-row-2">
4068
- <div class="toolbar-group" (mousedown)="preventFocusLoss($event)">
4069
- <span class="toolbar-label" id="tpl-spacing-label">{{ labels.t('emailTemplateEditor.blockSpacing') }}</span>
4070
- <ui-pill-tabs [tabs]="spacingTabs" [activeKey]="blockSpacing() || 'none'" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" (tabChange)="applySpacing($event === 'none' ? '' : $event)" />
4701
+ <div class="toolbar-group">
4702
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertLink')" [uiTooltip]="labels.t('emailTemplateEditor.insertLink')" (mousedown)="saveSelection()" (click)="openLinkDialog()">
4703
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
4704
+ </ui-button>
4705
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertImage')" [uiTooltip]="labels.t('emailTemplateEditor.insertImage')" (mousedown)="saveSelection()" (click)="openImageDialog()">
4706
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
4707
+ </ui-button>
4708
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.insertTable')" [uiTooltip]="labels.t('emailTemplateEditor.insertTable')" (mousedown)="saveSelection()" (click)="insertTable()">
4709
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>
4710
+ </ui-button>
4711
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.blockQuote')" [uiTooltip]="labels.t('emailTemplateEditor.blockQuote')" data-testid="quote-button" (click)="toggleQuote()">
4712
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 21c3 0 7-1 7-8V5H3v8h4c0 3-2 4-4 4zm11 0c3 0 7-1 7-8V5h-7v8h4c0 3-2 4-4 4z"/></svg>
4713
+ </ui-button>
4714
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.horizontalLine')" [uiTooltip]="labels.t('emailTemplateEditor.horizontalLine')" (click)="execCommand('insertHorizontalRule')">
4715
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="3" y1="12" x2="21" y2="12"/></svg>
4716
+ </ui-button>
4717
+ </div>
4718
+ <div class="toolbar-group">
4719
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emoji')" [uiTooltip]="labels.t('emailTemplateEditor.tipEmoji')" data-testid="emoji-button" (mousedown)="saveSelection()" (click)="toggleEmojiPanel()">
4720
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>
4721
+ </ui-button>
4722
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.specialCharacters')" [uiTooltip]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-button" (mousedown)="saveSelection()" (click)="toggleSpecialPanel()">
4723
+ <span class="tb-sub">ฮฉ</span>
4724
+ </ui-button>
4725
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.clearFormatting')" [uiTooltip]="labels.t('emailTemplateEditor.clearFormatting')" (click)="execCommand('removeFormat')">
4726
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/><line x1="3" y1="3" x2="21" y2="21"/></svg>
4727
+ </ui-button>
4071
4728
  </div>
4729
+ <div class="toolbar-group">
4730
+ <ui-select class="toolbar-select" size="sm" data-testid="spacing-select" [ariaLabel]="labels.t('emailTemplateEditor.blockSpacing')" [uiTooltip]="labels.t('emailTemplateEditor.blockSpacing')" [options]="spacingOptions" [ngModel]="blockSpacing() || 'none'"
4731
+ (mousedown)="saveSelection()" (ngModelChange)="applySpacing($event === 'none' ? '' : $event)" />
4732
+ </div>
4733
+ @if (inTable()) {
4734
+ <div class="toolbar-group" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.tableTools')" data-testid="table-tools">
4735
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableAddRow')" [uiTooltip]="labels.t('emailTemplateEditor.tableAddRow')" (click)="tableAddRow()"><span class="tb-sub">+ โ†“</span></ui-button>
4736
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableAddColumn')" [uiTooltip]="labels.t('emailTemplateEditor.tableAddColumn')" (click)="tableAddColumn()"><span class="tb-sub">+ โ†’</span></ui-button>
4737
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDeleteRow')" [uiTooltip]="labels.t('emailTemplateEditor.tableDeleteRow')" (click)="tableDeleteRow()"><span class="tb-sub">โˆ’ โ†“</span></ui-button>
4738
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDeleteColumn')" [uiTooltip]="labels.t('emailTemplateEditor.tableDeleteColumn')" (click)="tableDeleteColumn()"><span class="tb-sub">โˆ’ โ†’</span></ui-button>
4739
+ <ui-button variant="ghost" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.tableDelete')" [uiTooltip]="labels.t('emailTemplateEditor.tableDelete')" (click)="tableDelete()"><span class="tb-sub">โœ•</span></ui-button>
4740
+ </div>
4741
+ }
4072
4742
  </div>
4073
4743
  }
4074
4744
 
@@ -4077,9 +4747,9 @@ i0.ษตษตngDeclareClassMetadata({
4077
4747
  <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertLink')">
4078
4748
  <div class="link-dialog-inner">
4079
4749
  <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.insertLink2') }}</span>
4080
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink()" />
4750
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkAddress')" placeholder="https://example.com" [(ngModel)]="linkUrl" [error]="linkUrlError()" (keydown.enter)="insertLink(); $event.preventDefault()" />
4081
4751
  @if (!linkTextFromSelection()) {
4082
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink()" />
4752
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.linkText')" [placeholder]="labels.t('emailTemplateEditor.linkTextOptional')" [(ngModel)]="linkText" (keydown.enter)="insertLink(); $event.preventDefault()" />
4083
4753
  }
4084
4754
  <div class="link-dialog-actions">
4085
4755
  <ui-button variant="secondary" size="sm" (click)="showLinkDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
@@ -4089,6 +4759,63 @@ i0.ษตษตngDeclareClassMetadata({
4089
4759
  </div>
4090
4760
  }
4091
4761
 
4762
+ <!-- Colour picker (inline panel, for the text colour and the highlight): a grid of ready colours, a custom colour (the browser's own dialog) and Remove -->
4763
+ @if (canWrite() && colorPanel(); as which) {
4764
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)">
4765
+ <div class="emoji-panel-head">
4766
+ <span class="link-dialog-title">{{ labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor') }}</span>
4767
+ <ui-button variant="secondary" size="sm" data-testid="color-remove" (click)="removeColor(which)">{{ labels.t('emailTemplateEditor.removeColor') }}</ui-button>
4768
+ <ui-button variant="secondary" size="sm" data-testid="color-custom" (click)="openCustomColor(which)">{{ labels.t('emailTemplateEditor.customColor') }}</ui-button>
4769
+ <ui-button variant="secondary" size="sm" (click)="colorPanel.set(null)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
4770
+ </div>
4771
+ <div class="color-grid" data-testid="color-grid">
4772
+ @for (c of colorSwatches; track c) {
4773
+ <button type="button" class="color-swatch" [style.background]="c" [attr.aria-label]="c" [attr.title]="c" [class.selected]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" (click)="pickColor(which, c)"></button>
4774
+ }
4775
+ </div>
4776
+ </div>
4777
+ }
4778
+
4779
+ <!-- Emoji picker (inline popover): a search box, category tabs and a skin tone; a click inserts the emoji at the caret and the panel stays open for more -->
4780
+ @if (canWrite() && showEmojiPanel()) {
4781
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)">
4782
+ <div class="emoji-panel-head">
4783
+ <ui-text-input class="emoji-search" [ariaLabel]="labels.t('emailTemplateEditor.emojiSearch')" [placeholder]="labels.t('emailTemplateEditor.emojiSearch')" [(ngModel)]="emojiSearch" (mousedown)="saveSelection()" />
4784
+ <ui-select class="emoji-tone" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emojiSkinTone')" [options]="skinToneOptions()" [(ngModel)]="emojiTone" (mousedown)="saveSelection()" />
4785
+ <ui-button variant="secondary" size="sm" (click)="showEmojiPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
4786
+ </div>
4787
+ @if (!emojiSearch().trim()) {
4788
+ <div class="emoji-tabs" role="tablist" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')">
4789
+ @for (g of emojiGroupKeys; track g.key) {
4790
+ <button type="button" role="tab" class="emoji-tab" [class.active]="emojiGroup() === g.key" [attr.aria-selected]="emojiGroup() === g.key" [attr.aria-label]="emojiGroupLabel(g.key)" [attr.title]="emojiGroupLabel(g.key)" (click)="emojiGroup.set(g.key)">{{ g.icon }}</button>
4791
+ }
4792
+ </div>
4793
+ }
4794
+ <div class="emoji-grid" data-testid="emoji-grid">
4795
+ @for (e of shownEmojis(); track e.char) {
4796
+ <button type="button" class="emoji-btn" [attr.aria-label]="emojiName(e)" [attr.title]="e.words.split(' ').slice(0, 3).join(' ')" (click)="insertEmoji(emojiWithTone(e))">{{ emojiWithTone(e) }}</button>
4797
+ } @empty {
4798
+ <span class="emoji-empty">{{ labels.t('emailTemplateEditor.emojiNoResults') }}</span>
4799
+ }
4800
+ </div>
4801
+ </div>
4802
+ }
4803
+
4804
+ <!-- Special characters (inline popover) -->
4805
+ @if (canWrite() && showSpecialPanel()) {
4806
+ <div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)">
4807
+ <div class="emoji-panel-head">
4808
+ <span class="link-dialog-title">{{ labels.t('emailTemplateEditor.specialCharactersTitle') }}</span>
4809
+ <ui-button variant="secondary" size="sm" (click)="showSpecialPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
4810
+ </div>
4811
+ <div class="emoji-grid">
4812
+ @for (c of specialCharacters; track c) {
4813
+ <button type="button" class="emoji-btn special-btn" [attr.aria-label]="c" (click)="insertEmoji(c)">{{ c }}</button>
4814
+ }
4815
+ </div>
4816
+ </div>
4817
+ }
4818
+
4092
4819
  <!-- Image URL dialog -->
4093
4820
  @if (canWrite() && showImageDialog()) {
4094
4821
  <div class="link-dialog" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.insertImage')">
@@ -4099,8 +4826,8 @@ i0.ษตษตngDeclareClassMetadata({
4099
4826
  <ui-button variant="secondary" size="sm" [loading]="imageUploading()" (click)="imageFile.click()">{{ imageUploading() ? labels.t('emailTemplateEditor.uploadingImage') : labels.t('emailTemplateEditor.uploadImage') }}</ui-button>
4100
4827
  <ui-error [errorId]="idPrefix() + '-image-upload-error'" [message]="imageUploadError()" />
4101
4828
  }
4102
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl()" />
4103
- <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl()" />
4829
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAddress')" placeholder="https://example.com/image.jpg" [(ngModel)]="imageUrl" [error]="imageUrlError()" (keydown.enter)="insertImageFromUrl(); $event.preventDefault()" />
4830
+ <ui-text-input class="link-dialog-input" [ariaLabel]="labels.t('emailTemplateEditor.imageAltText')" [placeholder]="labels.t('emailTemplateEditor.altTextOptional')" [(ngModel)]="imageAlt" (keydown.enter)="insertImageFromUrl(); $event.preventDefault()" />
4104
4831
  <div class="link-dialog-actions">
4105
4832
  <ui-button variant="secondary" size="sm" (click)="showImageDialog.set(false)">{{ labels.t('common.cancel') }}</ui-button>
4106
4833
  <ui-button variant="primary" size="sm" [disabled]="!canInsertImage()" (click)="insertImageFromUrl()">{{ labels.t('common.insert') }}</ui-button>
@@ -4121,56 +4848,16 @@ i0.ษตษตngDeclareClassMetadata({
4121
4848
  </ui-alert>
4122
4849
  }
4123
4850
 
4124
- <!-- Block Canvas with DnD -->
4125
- <div class="blocks-canvas" (dragover)="onCanvasDragOver($event)" (drop)="onDropZoneDrop($event, blocks().length)" (focusout)="onBodyFocusOut($event)">
4126
- <!-- Initial drop zone (before first block) -->
4127
- <div class="drop-zone" [class.active]="dragOverIndex() === 0" (dragover)="onDropZoneDragOver($event, 0)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, 0)">
4128
- <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
4129
- </div>
4130
-
4131
- @for (block of blocks(); track block.id; let i = $index) {
4132
- <div class="block-wrapper" #blockWrapper [class.selected]="selectedBlockId() === block.id" [class.dragging]="dragFromCanvas() === i" (dragend)="onBlockDragEnd()">
4133
- @if (canWrite()) {
4134
- <!-- Only the handle is draggable: a draggable ancestor of the contenteditable breaks text selection in Firefox / Safari. Move up / down below are the keyboard and touch alternative. -->
4135
- <div class="block-drag-handle" [attr.title]="labels.t('emailTemplateEditor.dragToReorder')" draggable="true" (dragstart)="onBlockDragStart($event, i, blockWrapper)">
4136
- <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
4137
- </div>
4138
- }
4139
-
4140
- <!-- Block content (contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps) -->
4141
- <div #blockEditor class="block-content" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.emailBlockN', { n: i + 1 })"
4142
- [attr.data-block-id]="block.id" [attr.data-placeholder]="i === 0 ? startPlaceholder() : labels.t('emailTemplateEditor.clickToEdit')" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
4143
- (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (click)="selectedBlockId.set(block.id)"></div>
4144
-
4145
- @if (canWrite()) {
4146
- <div class="block-controls">
4147
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockUp')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveUp')" [disabled]="i === 0" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, -1)">
4148
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M18 15l-6-6-6 6"/></svg>
4149
- </ui-button>
4150
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.moveBlockDown')" [uiTooltip]="labels.t('emailTemplateEditor.tipMoveDown')" [disabled]="i === blocks().length - 1" (mousedown)="preventFocusLoss($event)" (click)="moveBlock(i, 1)">
4151
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
4152
- </ui-button>
4153
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.duplicateBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDuplicate')" (mousedown)="preventFocusLoss($event)" (click)="duplicateBlock(i)">
4154
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
4155
- </ui-button>
4156
- @if (blocks().length > 1) {
4157
- <ui-button variant="ghost" size="xs" [ariaLabel]="labels.t('emailTemplateEditor.deleteBlock')" [uiTooltip]="labels.t('emailTemplateEditor.tipDeleteBlock')" (mousedown)="preventFocusLoss($event)" (click)="deleteBlock(i)">
4158
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>
4159
- </ui-button>
4160
- }
4161
- </div>
4162
- }
4851
+ <!-- The document: ONE editing surface, like a word processor. The page is as wide as a sent email's card (600px) with the same 28px side padding, so the text wraps as it does in an inbox. -->
4852
+ <div class="blocks-canvas" [style.font-family]="canvasFont()" (focusout)="onBodyFocusOut($event)">
4853
+ @for (block of blocks(); track block.id) {
4854
+ <div class="block-wrapper">
4855
+ <!-- contenteditable, initialised ONCE after render so Angular never rewrites it and the caret never jumps -->
4856
+ <div #blockEditor class="block-content tpl-doc" role="textbox" aria-multiline="true" [attr.aria-label]="labels.t('emailTemplateEditor.documentLabel')"
4857
+ [attr.data-block-id]="block.id" [attr.data-placeholder]="startPlaceholder()" [attr.contenteditable]="canWrite() ? 'true' : 'false'"
4858
+ (input)="onBlockInput($event, block)" (beforeinput)="onBlockBeforeInput($any($event))" (focus)="onBlockFocus(block)" (keyup)="refreshContext()" (mouseup)="refreshContext()" (keydown.enter)="onDocEnter($event)"
4859
+ (dragover)="onDocDragOver($event)" (drop)="onDocDrop($event)"></div>
4163
4860
  </div>
4164
-
4165
- <!-- Drop zone after each block -->
4166
- <div class="drop-zone" [class.active]="dragOverIndex() === i + 1" (dragover)="onDropZoneDragOver($event, i + 1)" (dragleave)="onDropZoneLeave()" (drop)="onDropZoneDrop($event, i + 1)">
4167
- <span class="drop-zone-label">{{ labels.t('emailTemplateEditor.dropHere') }}</span>
4168
- </div>
4169
- }
4170
-
4171
- @if (canWrite()) {
4172
- <button type="button" class="add-block-btn" (click)="addBlock('text-block')">
4173
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>{{ labels.t('emailTemplateEditor.addBlock') }}</button>
4174
4861
  }
4175
4862
  </div>
4176
4863
  }
@@ -4246,9 +4933,12 @@ i0.ษตษตngDeclareClassMetadata({
4246
4933
  @if (activeRightTab() === 'variables') {
4247
4934
  <div class="right-panel-body">
4248
4935
  <h4 class="right-section-title">{{ labels.t('emailTemplateEditor.templateVariables') }}</h4>
4249
- <p class="right-section-desc">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
4250
-
4251
- @for (group of variableGroups(); track group.name) {
4936
+ @if (variablesNeedAssignment()) {
4937
+ <p class="right-section-desc" role="status" data-testid="variables-need-assignment">{{ labels.t('emailTemplateEditor.assignToSeeVariables') }}</p>
4938
+ } @else {
4939
+ <p class="right-section-desc" data-testid="variables-click-hint">{{ labels.t('emailTemplateEditor.clickAVariableToInsert') }}</p>
4940
+ }
4941
+ @for (group of availableVariableGroups(); track group.name) {
4252
4942
  <div class="block-group">
4253
4943
  <button type="button" class="block-group-header" [attr.aria-expanded]="isOpen('v:' + group.name)" (click)="toggleGroup('v:' + group.name)">
4254
4944
  <svg class="chevron" [class.expanded]="isOpen('v:' + group.name)" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
@@ -4351,7 +5041,7 @@ i0.ษตษตngDeclareClassMetadata({
4351
5041
 
4352
5042
 
4353
5043
  `,
4354
- styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}.email-checks{margin:8px 12px 0}.email-checks-list{margin:0;padding-left:18px}.hidden-file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.add-block-btn:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-row-2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 20px;background:#fff;border-bottom:1px solid #e2e8f0}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:600px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-wrapper{flex-shrink:0;position:relative;display:flex;align-items:flex-start;background:#fff;border:2px solid transparent;border-radius:8px;transition:border-color .15s,box-shadow .15s}.block-wrapper:hover,.block-wrapper.selected,.block-wrapper:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.block-wrapper:hover .block-drag-handle,.block-wrapper.selected .block-drag-handle,.block-wrapper:focus-within .block-drag-handle{opacity:1}.block-wrapper:hover .block-controls,.block-wrapper.selected .block-controls,.block-wrapper:focus-within .block-controls{opacity:1;pointer-events:all}.block-wrapper.dragging{opacity:.4}.block-drag-handle{flex-shrink:0;width:28px;display:flex;align-items:flex-start;justify-content:center;padding-top:14px;opacity:0;transition:opacity .15s;cursor:grab;color:#94a3b8}.block-drag-handle:active{cursor:grabbing}.block-content{flex:1;min-width:0;padding:12px 16px;outline:none;font-size:.9375rem;color:#1e293b;line-height:1.6;min-height:48px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}.block-content p{margin:0 0 8px}.block-content p:last-child{margin:0}.block-content h1,.block-content h2,.block-content h3{margin:8px 0 6px;color:#1e293b}.block-content a{color:#3b82f6}.block-content img{max-width:100%;border-radius:6px}.block-content ul,.block-content ol{padding-left:20px;margin:0 0 8px}.block-controls{position:absolute;top:0;left:-48px;flex-direction:column;display:flex;gap:2px;opacity:0;pointer-events:none;transition:opacity .15s;background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:3px;box-shadow:0 2px 6px #00000014}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}@media(hover:none){.block-wrapper.selected .block-controls{opacity:1;pointer-events:all}}.drop-zone{flex-shrink:0;height:8px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:height .15s,background .15s;position:relative}.drop-zone-label{font-size:.75rem;font-weight:600;color:#1d4ed8;opacity:0;transition:opacity .1s}.drop-zone.active{height:40px;background:#3b82f614;border:2px dashed #3b82f6}.drop-zone.active .drop-zone-label{opacity:1}.add-block-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;padding:12px;margin-top:8px;border:2px dashed #e2e8f0;border-radius:8px;background:none;font-size:.875rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:border-color .15s,color .15s,background .15s}.add-block-btn:hover{border-color:#3b82f6;color:#3b82f6;background:#3b82f60a}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.toolbar-row-2,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"]
5044
+ styles: [":host{display:flex;flex-direction:column;flex:1;min-height:0}.required{color:#ef4444;font-weight:400}.editor-page{display:flex;flex-direction:column;flex:1;min-height:0;background:#f8fafc;overflow:hidden}.editor-actions{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 0 12px;flex-shrink:0}.editor-heading-group{display:flex;align-items:center;gap:4px;min-width:0}.editor-heading{margin:0;font-size:1.25rem;font-weight:700;color:#1e293b;line-height:1.3;min-width:0}.save-wrap{display:inline-flex}.save-hint{margin:0;font-size:12px;color:#475569;flex-basis:100%;text-align:right}.editor-actions-buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-left:auto}.readonly-note{margin:0;padding:8px 16px;font-size:.8125rem;color:#92400e;background:#fffbeb;border-bottom:1px solid #fde68a}.readonly-note.system-note{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.editor-body{display:grid;grid-template-columns:340px minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.panel-left{background:#fff;border-right:1px solid #e2e8f0;padding:24px;overflow-y:auto;overflow-x:hidden}.panel-title{font-size:1.0625rem;font-weight:700;color:#1e293b;margin:0 0 20px}.form-field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}.form-row-dates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}.form-row-dates>*{min-width:0}.email-checks{margin:8px 12px 0}.email-checks-list{margin:0;padding-left:18px}.hidden-file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.assignments-section{border-top:1px solid #e2e8f0;padding-top:20px;margin-top:16px}.section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 6px}.section-desc{font-size:.8125rem;color:#64748b;line-height:1.5;margin:0 0 12px}.assignment-list{max-height:340px;overflow-y:auto;margin-top:12px;border:1px solid #e2e8f0;border-radius:8px}.assignment-group{position:sticky;top:0;z-index:1;padding:8px 14px;background:#f8fafc;border-bottom:1px solid #e2e8f0;font-size:.6875rem;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.04em}.assignment-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid #f1f5f9;transition:background .1s}.assignment-item:last-child{border-bottom:none}.assignment-item:hover{background:#f8fafc}.assignment-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.assignment-item.assignment-readonly{cursor:default}.assignment-item.assignment-readonly:hover{background:transparent}.assignment-text{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.assignment-text strong{font-size:.8125rem;color:#1e293b}.assignment-text span{font-size:.75rem;color:#64748b}.assignment-channels{display:flex;gap:4px;flex-shrink:0}.channel-badge{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;background:#f1f5f9;color:#64748b;transition:all .15s}.channel-badge.active{background:#3b82f6;color:#fff}.channel-badge.disabled{opacity:.4;cursor:not-allowed}.config-desc{font-size:.875rem;color:#64748b;line-height:1.5;margin:0}.config-divider{border:none;border-top:1px solid #e2e8f0;margin:20px 0}.config-section{display:flex;flex-direction:column;gap:12px}.config-section-label{font-size:.6875rem;font-weight:700;color:#3b82f6;text-transform:uppercase;letter-spacing:.04em}.config-field{display:flex;flex-direction:column;gap:6px}.config-field-mt{margin-top:16px}.config-label{font-size:.8125rem;font-weight:600;color:#1e293b}.config-readonly{padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:.875rem;color:#1e293b}.config-hint{font-size:.75rem;color:#64748b}.test-save-note{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#fef3c7;border:1px solid #fcd34d;border-radius:8px;font-size:.8125rem;color:#92400e;margin-top:12px}.test-save-note svg{flex-shrink:0}.panel-center{display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}.editor-tabs{display:flex;gap:2px;padding:12px 20px 0;background:#fff;border-bottom:1px solid #e2e8f0;overflow-x:auto;-webkit-overflow-scrolling:touch}.editor-tab{display:flex;align-items:center;gap:6px;padding:10px 16px;border:1px solid #e2e8f0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8fafc;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;white-space:nowrap}.editor-tab:hover{background:#fff;color:#1e293b}.editor-tab.active{background:#eff6ff;color:#1d4ed8;border-color:#93c5fd}.editor-tab:focus-visible,.right-tab:focus-visible,.block-group-header:focus-visible,.variable-item:focus-visible,.block-item:focus-visible,.video-lib-item:focus-visible{outline:2px solid #3b82f6;outline-offset:-2px}.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 20px;background:#fff;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:2px;padding-right:8px;border-right:1px solid #e2e8f0}.toolbar-group:last-child{border-right:none;padding-right:0}.toolbar-select{display:block;min-width:96px}.toolbar-label{font-size:.75rem;font-weight:600;color:#64748b;white-space:nowrap;margin-right:6px}.hidden-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none;border:none;padding:0}.color-indicator{display:flex;flex-direction:column;align-items:center;gap:2px;color:#475569}.color-bar{display:block;width:16px;height:3px;border-radius:2px;border:1px solid rgba(0,0,0,.1)}.link-dialog{background:#fff;border-bottom:1px solid #e2e8f0;padding:12px 20px}.link-dialog-inner{display:flex;align-items:flex-start;gap:8px;flex-wrap:wrap}.link-dialog-title{font-size:.8125rem;font-weight:700;color:#1e293b;white-space:nowrap;padding-top:10px}.link-dialog-input{display:block;width:240px;max-width:100%}.link-dialog-actions{display:flex;gap:6px}.emoji-panel-head{display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap}.emoji-search{display:block;flex:1 1 200px;min-width:160px}.emoji-tone{display:block;min-width:120px}.emoji-tabs{display:flex;gap:2px;border-bottom:1px solid #e2e8f0;margin-bottom:8px;overflow-x:auto}.emoji-tab{flex:0 0 auto;width:40px;height:36px;border:0;border-bottom:2px solid transparent;background:transparent;font-size:18px;cursor:pointer;font-family:\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Noto Color Emoji\",sans-serif}.emoji-tab.active{border-bottom-color:#3b82f6;background:#eff6ff}.color-grid{display:grid;grid-template-columns:repeat(10,28px);gap:4px}.color-swatch{width:28px;height:28px;border-radius:6px;border:1px solid rgba(0,0,0,.15);cursor:pointer;padding:0}.color-swatch:hover{transform:scale(1.1)}.color-swatch:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.color-swatch.selected{outline:2px solid #1e293b;outline-offset:1px}.emoji-grid{display:flex;flex-wrap:wrap;gap:2px;max-height:220px;overflow-y:auto}.emoji-empty{font-size:.8125rem;color:#64748b;padding:8px 4px}.emoji-btn{width:36px;height:36px;padding:0;border:0;border-radius:6px;background:transparent;font-size:20px;line-height:1;cursor:pointer;font-family:\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Noto Color Emoji\",sans-serif}.emoji-btn.special-btn{font-family:inherit;font-size:16px}.emoji-btn:hover,.emoji-btn:focus-visible{background:#f1f5f9}.tb-sub{font-size:12px;font-weight:700;line-height:1}@media(pointer:coarse){.emoji-btn{width:44px;height:44px}}.preview-frame{flex:1;display:flex;justify-content:center;align-items:stretch;padding:24px;overflow-y:auto;background:#f1f5f9}.preview-frame.mobile{align-items:flex-start}.preview-content{display:block;flex:1 1 auto;max-width:602px;width:100%;box-sizing:border-box;min-height:400px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.mobile-shell{width:375px;max-width:100%;box-sizing:border-box;min-height:600px;border:2px solid #1e293b;border-radius:24px;padding:40px 12px 24px;background:#fff;box-shadow:0 8px 32px #0000001f}.mobile-shell .preview-content{border:none;border-radius:0;max-width:100%;height:520px;min-height:0}.block-wrapper{flex-shrink:0;width:100%;max-width:602px;margin:0 auto;box-sizing:border-box;padding:24px 28px;background:#fff;border:1px solid #e2e8f0;border-radius:8px}.blocks-canvas{flex:1 1 0;min-height:0;padding:16px 20px 24px 56px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#f1f5f9;display:flex;flex-direction:column}.block-content{min-width:0;padding:0;outline:none;font-size:15px;color:#1e293b;line-height:1.6;min-height:320px;overflow-wrap:anywhere}.block-content:empty:before{content:attr(data-placeholder);color:#64748b;font-style:italic;pointer-events:none}@media(pointer:coarse){.editor-tab,.right-tab,.block-group-header{min-height:44px}}.panel-right{background:#fff;border-left:1px solid #e2e8f0;display:flex;flex-direction:column;min-height:0;min-width:0}.right-tabs{display:flex;border-bottom:1px solid #e2e8f0}.right-tab{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:12px;min-height:44px;border:none;background:none;font-size:.8125rem;font-weight:600;color:#64748b;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent}.right-tab:hover{color:#1e293b}.right-tab.active{color:#1d4ed8;background:#eff6ff;border-bottom-color:#3b82f6}.right-panel-body{flex:1;padding:20px;overflow-y:auto}.right-section-title{font-size:.9375rem;font-weight:700;color:#1e293b;margin:0 0 12px}.right-section-desc{font-size:.8125rem;color:#64748b;margin:0 0 16px;line-height:1.5}.right-section-hint{font-size:.8125rem;color:#64748b;margin:0 0 12px;line-height:1.5}.block-group{border-bottom:1px solid #f1f5f9}.block-group-header{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:12px 0;border:none;background:none;font-size:.875rem;font-weight:600;color:#1e293b;cursor:pointer;font-family:inherit;text-align:left}.block-group-header .chevron{transition:transform .2s;color:#94a3b8}.block-group-header .chevron.expanded{transform:rotate(90deg)}.block-group-header span:nth-of-type(1){flex:1}.block-count{font-size:.75rem;font-weight:600;color:#475569;background:#f1f5f9;padding:2px 8px;border-radius:10px;margin-left:auto}.block-list{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}.variable-list{display:flex;flex-direction:column;padding-bottom:8px}.variable-item+.variable-item{border-top:1px solid #f1f5f9;border-radius:0}.block-item{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;min-height:44px;padding:8px 0;font-size:.8125rem;color:#64748b;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit;-webkit-user-select:none;user-select:none}.block-item:hover{background:#f8fafc;color:#1e293b}.block-item-drag{color:#cbd5e1;flex-shrink:0;cursor:grab}.variable-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:44px;padding:8px 0;min-width:0;width:100%;box-sizing:border-box;border:none;background:none;cursor:pointer;text-align:left;border-radius:4px;font-family:inherit}.variable-item:hover{background:#f8fafc}.var-tag{max-width:100%;overflow-wrap:anywhere;font-size:.75rem;font-weight:600;color:#1d4ed8;background:#3b82f614;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.var-example{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.var-description{font-size:.75rem;color:#64748b;line-height:1.4;overflow-wrap:anywhere}.video-library-panel{padding:0}.video-library-panel .right-section-title,.video-library-panel .right-section-hint{padding:0 16px}.video-library-panel .right-section-title{padding-top:16px}.video-config-section{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-bottom:1px solid #f1f5f9}.video-config-section:last-of-type{border-bottom:none}.video-lib-list{display:flex;flex-direction:column;gap:2px;padding:8px 8px 16px}.video-lib-item{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px;border:1px solid transparent;border-radius:8px;background:none;cursor:pointer;text-align:left;font-family:inherit;transition:background .15s,border-color .15s}.video-lib-item:hover{background:#f8fafc;border-color:#e2e8f0}.video-lib-item.selected{background:#eff6ff;border-color:#93c5fd}.vli-thumb{position:relative;flex-shrink:0;width:56px;height:40px;border-radius:6px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);display:flex;align-items:center;justify-content:center}.vli-dur{position:absolute;bottom:2px;right:3px;font-size:.625rem;font-weight:600;color:#fff;background:#000000a6;padding:1px 4px;border-radius:3px}.vli-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.vli-title{font-size:.8125rem;font-weight:600;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vli-cat{font-size:.75rem;color:#475569}.vli-check{flex-shrink:0}.video-lib-loading{padding:8px}.video-lib-skeleton{display:flex;align-items:center;gap:10px;padding:8px;margin-bottom:4px}.vls-info{flex:1;display:flex;flex-direction:column;gap:6px}@media(max-width:1200px){.editor-body{grid-template-columns:280px minmax(0,1fr) 260px}}@media(max-width:900px){:host{flex:none}.editor-page{flex:none;min-height:100vh;min-height:100dvh;overflow:visible}.editor-body{display:flex;flex-direction:column;flex:none;overflow:visible}.panel-left{border-right:none;border-bottom:1px solid #e2e8f0;overflow:visible;padding:16px}.panel-center{overflow:visible;min-height:480px}.blocks-canvas{overflow:visible;min-height:320px}.panel-right{border-left:none;border-top:1px solid #e2e8f0}.right-panel-body{overflow:visible}.editor-toolbar,.link-dialog,.editor-tabs{padding-left:12px;padding-right:12px}.preview-frame{padding:12px}.form-row-dates{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}\n"]
4355
5045
  }]
4356
5046
  }],
4357
5047
  ctorParameters: () => [],
@@ -4388,6 +5078,14 @@ i0.ษตษตngDeclareClassMetadata({
4388
5078
  required: false
4389
5079
  }]
4390
5080
  }],
5081
+ showSaveHint: [{
5082
+ type: i0.Input,
5083
+ args: [{
5084
+ isSignal: true,
5085
+ alias: "showSaveHint",
5086
+ required: false
5087
+ }]
5088
+ }],
4391
5089
  previewBrand: [{
4392
5090
  type: i0.Input,
4393
5091
  args: [{
@@ -4635,6 +5333,10 @@ i0.ษตษตngDeclareClassMetadata({
4635
5333
  colorInputRef: [{
4636
5334
  type: i0.ViewChild,
4637
5335
  args: ["colorInput", { isSignal: true }]
5336
+ }],
5337
+ highlightInputRef: [{
5338
+ type: i0.ViewChild,
5339
+ args: ["highlightInput", { isSignal: true }]
4638
5340
  }]
4639
5341
  }
4640
5342
  });
@@ -4781,6 +5483,6 @@ i0.ษตษตngDeclareClassMetadata({
4781
5483
  args: [{ providedIn: "root" }]
4782
5484
  }]
4783
5485
  });
4784
- export { DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS, DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS, EMAIL_BLOCK_DRAG_TYPE, EMAIL_TEMPLATE_MAX_BODY, EMAIL_TEMPLATE_MAX_TEXT, EMAIL_TEMPLATE_START_TEXT, EmailTemplateEditorComponent, InspectionTemplatePrintService, MAX_EMAIL_ADDRESS_LENGTH, RICH_TEXT_OPTIONS, RichTextEditorComponent, blockHasContent, buildInspectionTemplateHtml, buildPreviewDocument, buildVideoBlockHtml, escapeHtml, fillSampleVariables, findEmailChecks, formatCategoryLabel, formatVideoDuration, insideEditorBlock, inspectionTemplateStatusLabel, isBlockDrag, isValidEmailAddress, isVariableAddress, isWebUrl, localizedEmailBlockGroups, localizedEmailVariableGroups, plainTextToHtml, safePreviewBrand, sanitizeRichTextHtml, serializedTextLength, usedVariableKeys };
5486
+ export { DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS, DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS, EMAIL_BLOCK_DRAG_TYPE, EMAIL_DEFAULT_FONT, EMAIL_EMOJIS, EMAIL_EMOJI_GROUP_KEYS, EMAIL_SKIN_TONES, EMAIL_SPECIAL_CHARACTERS, EMAIL_TEMPLATE_MAX_BODY, EMAIL_TEMPLATE_MAX_TEXT, EMAIL_TEMPLATE_START_TEXT, EmailTemplateEditorComponent, InspectionTemplatePrintService, MAX_EMAIL_ADDRESS_LENGTH, RICH_TEXT_OPTIONS, RichTextEditorComponent, blockHasContent, buildInspectionTemplateHtml, buildPreviewDocument, buildVideoBlockHtml, escapeHtml, fillSampleVariables, findEmailChecks, findEmojis, formatCategoryLabel, formatVideoDuration, insideEditorBlock, inspectionTemplateStatusLabel, isBlockDrag, isValidEmailAddress, isVariableAddress, isWebUrl, localizedEmailBlockGroups, localizedEmailVariableGroups, plainTextToHtml, safePreviewBrand, sanitizeRichTextHtml, serializedTextLength, usedVariableKeys, withSkinTone };
4785
5487
 
4786
5488
  //# sourceMappingURL=forgeroute-ui-editor.mjs.map