7b4b9e1cc4
This enables JavaScripts projects to have live previews straight in the browser without requiring any local configuration. This uses the CodeSandbox package `sandpack` to compile it all inside of an iframe. This feature is off by default and can be toggled on in the admin settings. Only projects with a `package.json` and a `main` key are supported. Updates happen in real-time with hot-reloading. We just watch for changes to files and then send them to `sandpack` to allow it to reload the iframe. The iframe includes a very simple navigation bar, the text bar is `readonly` to stop users navigating away from the preview and the back and forward buttons just pop/splice the navigation stack which is tracked by a listener on `sandpack` There is a button inside the iframe which allows the user to open the projects inside of CodeSandbox. This button is only visible on **public** projects. On private or internal projects this button get hidden to protect private code being leaked into an external public URL. Closes #47268
63 lines
1.2 KiB
JavaScript
63 lines
1.2 KiB
JavaScript
// Fuzzy file finder
|
|
export const MAX_FILE_FINDER_RESULTS = 40;
|
|
export const FILE_FINDER_ROW_HEIGHT = 55;
|
|
export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33;
|
|
|
|
export const MAX_WINDOW_HEIGHT_COMPACT = 750;
|
|
|
|
// Commit message textarea
|
|
export const MAX_TITLE_LENGTH = 50;
|
|
export const MAX_BODY_LENGTH = 72;
|
|
|
|
export const activityBarViews = {
|
|
edit: 'ide-tree',
|
|
commit: 'commit-section',
|
|
review: 'ide-review',
|
|
};
|
|
|
|
export const viewerTypes = {
|
|
mr: 'mrdiff',
|
|
edit: 'editor',
|
|
diff: 'diff',
|
|
};
|
|
|
|
export const diffModes = {
|
|
replaced: 'replaced',
|
|
new: 'new',
|
|
deleted: 'deleted',
|
|
renamed: 'renamed',
|
|
};
|
|
|
|
export const rightSidebarViews = {
|
|
pipelines: 'pipelines-list',
|
|
jobsDetail: 'jobs-detail',
|
|
mergeRequestInfo: 'merge-request-info',
|
|
clientSidePreview: 'clientside',
|
|
};
|
|
|
|
export const stageKeys = {
|
|
unstaged: 'unstaged',
|
|
staged: 'staged',
|
|
};
|
|
|
|
export const commitItemIconMap = {
|
|
addition: {
|
|
icon: 'file-addition',
|
|
class: 'ide-file-addition',
|
|
},
|
|
modified: {
|
|
icon: 'file-modified',
|
|
class: 'ide-file-modified',
|
|
},
|
|
deleted: {
|
|
icon: 'file-deletion',
|
|
class: 'ide-file-deletion',
|
|
},
|
|
};
|
|
|
|
export const modalTypes = {
|
|
rename: 'rename',
|
|
tree: 'tree',
|
|
};
|
|
|
|
export const packageJsonPath = 'package.json';
|