Skip to content

Commit f1c9d37

Browse files
committed
feat: add pen icon to edit text in the more options box
1 parent 3dee3d6 commit f1c9d37

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ function RemoteFunctions(config) {
301301
function handleOptionClick(e, action, element) {
302302
if (action === "select-parent") {
303303
_handleSelectParentOptionClick(e, element);
304+
} else if (action === "edit-text") {
305+
startEditing(element);
304306
} else if (action === "duplicate") {
305307
_handleDuplicateOptionClick(e, element);
306308
} else if (action === "delete") {
@@ -545,8 +547,8 @@ function RemoteFunctions(config) {
545547
// calc estimate width based on the char count
546548
const infoBoxWidth = basePadding + (charCount * avgCharWidth);
547549

548-
// more options box is 82px
549-
const moreOptionsBoxWidth = 82;
550+
// more options box is 106px
551+
const moreOptionsBoxWidth = 106;
550552

551553
// check if there's enough space for both boxes
552554
// 20px buffer for spacing between boxes
@@ -600,8 +602,7 @@ function RemoteFunctions(config) {
600602
let elemBounds = this.element.getBoundingClientRect();
601603

602604
// the box width and the positions where it should be placed
603-
const boxWidth = 82;
604-
const boxHeight = 40; // rough estimate for options box
605+
const boxWidth = 106;
605606
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
606607
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
607608

@@ -641,6 +642,12 @@ function RemoteFunctions(config) {
641642
</svg>
642643
`,
643644

645+
edit: `
646+
<svg viewBox="0 0 24 24" fill="currentColor">
647+
<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>
648+
</svg>
649+
`,
650+
644651
copy: `
645652
<svg viewBox="0 0 24 24" fill="currentColor">
646653
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0
@@ -660,6 +667,9 @@ function RemoteFunctions(config) {
660667
<span data-action="select-parent" title="Select Parent">
661668
${ICONS.arrowUp}
662669
</span>
670+
<span data-action="edit-text" title="Edit Text">
671+
${ICONS.edit}
672+
</span>
663673
<span data-action="duplicate" title="Duplicate">
664674
${ICONS.copy}
665675
</span>

0 commit comments

Comments
 (0)