Repository: excalidraw/excalidraw
File: src/components/App.tsx (TypeScript)

Code before:
        ContextMenu.push({
          options: [
            this.device.isMobile && actionCut,
            this.device.isMobile && navigator.clipboard && actionCopy,
            this.device.isMobile &&
              navigator.clipboard && {
                name: "paste",
                trackEvent: false,
                perform: (elements, appStates) => {
                  this.pasteFromClipboard(null);
                  return {
                    commitToHistory: false,
                  };
                },
                contextItemLabel: "labels.paste",
              },
            this.device.isMobile && separator,
            ...options,
            separator,
            actionCopyStyles,
            actionPasteStyles,
            separator,
            maybeGroupAction && actionGroup,
            mayBeAllowUnbinding && actionUnbindText,
            mayBeAllowBinding && actionBindText,
            mayBeAllowToggleLineEditing && actionToggleLineEditor,
            maybeUngroupAction && actionUngroup,
            (maybeGroupAction || maybeUngroupAction) && separator,
            actionAddToLibrary,
            separator,
            actionSendBackward,
            actionBringForward,
            actionSendToBack,
            actionBringToFront,
            separator,
            maybeFlipHorizontal && actionFlipHorizontal,
            maybeFlipVertical && actionFlipVertical,
            (maybeFlipHorizontal || maybeFlipVertical) && separator,
            actionLink.contextItemPredicate(elements, this.state) && actionLink,
            actionDuplicateSelection,
            actionToggleLock,
            separator,
            actionDeleteSelected,
          ],
          top,
          left,
          actionManager: this.actionManager,
          appState: this.state,
          container: this.excalidrawContainerRef.current!,
          elements,
        });

Review comment (refactor):
we should put the item into the group with lock/duplicate as that's functionally closer than adding to a library

![image](https://user-images.githubusercontent.com/5153846/192304522-adbea0b5-ebda-4eb1-a786-f5cca59bb948.png)


Code after:
        ContextMenu.push({
          options: [
            this.device.isMobile && actionCut,
            this.device.isMobile && navigator.clipboard && actionCopy,
            this.device.isMobile &&
              navigator.clipboard && {
                name: "paste",
                trackEvent: false,
                perform: (elements, appStates) => {
                  this.pasteFromClipboard(null);
                  return {
                    commitToHistory: false,
                  };
                },
                contextItemLabel: "labels.paste",
              },
            this.device.isMobile && separator,
            ...options,
            separator,
            actionCopyStyles,
            actionPasteStyles,
            separator,
            maybeGroupAction && actionGroup,
            mayBeAllowUnbinding && actionUnbindText,
            mayBeAllowBinding && actionBindText,
            maybeUngroupAction && actionUngroup,
            (maybeGroupAction || maybeUngroupAction) && separator,
            actionAddToLibrary,
            separator,
            actionSendBackward,
            actionBringForward,
            actionSendToBack,
            actionBringToFront,
            separator,
            maybeFlipHorizontal && actionFlipHorizontal,
            maybeFlipVertical && actionFlipVertical,
            (maybeFlipHorizontal || maybeFlipVertical) && separator,
            mayBeAllowToggleLineEditing && actionToggleLinearEditor,
            actionLink.contextItemPredicate(elements, this.state) && actionLink,
            actionDuplicateSelection,
            actionToggleLock,
            separator,
            actionDeleteSelected,
          ],
          top,
          left,
          actionManager: this.actionManager,
          appState: this.state,
          container: this.excalidrawContainerRef.current!,
          elements,
        });