diff --git a/packages/iobroker.vis-2/main.js b/packages/iobroker.vis-2/main.js index ce70125e..f820ed5a 100644 --- a/packages/iobroker.vis-2/main.js +++ b/packages/iobroker.vis-2/main.js @@ -855,7 +855,7 @@ async function buildHtmlPages(forceBuild) { } catch (err) { // ignore } - if (typeof uploadedIndexHtml === 'object') { + if (uploadedIndexHtml && typeof uploadedIndexHtml === 'object') { uploadedIndexHtml = uploadedIndexHtml.file; } uploadedIndexHtml = uploadedIndexHtml ? uploadedIndexHtml.toString('utf8') : uploadedIndexHtml; @@ -870,7 +870,7 @@ async function buildHtmlPages(forceBuild) { } catch (err) { // ignore } - if (typeof uploadedEditHtml === 'object') { + if (uploadedEditHtml && typeof uploadedEditHtml === 'object') { uploadedEditHtml = uploadedEditHtml.file; } uploadedEditHtml = uploadedEditHtml ? uploadedEditHtml.toString('utf8') : uploadedEditHtml; diff --git a/packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx b/packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx index 00268494..4e5ca4a3 100644 --- a/packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx +++ b/packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx @@ -10,18 +10,18 @@ import { Select, Switch, TextField, - FormHelperText, + FormHelperText, IconButton, } from '@mui/material'; -import { Save as SaveIcon } from '@mui/icons-material'; +import { ContentCopy, Save as SaveIcon } from '@mui/icons-material'; -import type { LegacyConnection } from '@iobroker/adapter-react-v5'; -import { I18n } from '@iobroker/adapter-react-v5'; +import { I18n, Utils, type LegacyConnection } from '@iobroker/adapter-react-v5'; import type Editor from '@/Editor'; import { store } from '@/Store'; import { deepClone } from '@/Utils/utils'; import type { ProjectSettings } from '@iobroker/types-vis-2'; +import commonStyles from '@/Utils/styles'; import IODialog from '../Components/IODialog'; const styles: { dialog: React.CSSProperties; field: React.CSSProperties } = { @@ -170,7 +170,21 @@ const Settings: React.FC = props => { { type: 'raw', Node: <> - setInstance(e.target.value)} /> + setInstance(e.target.value)} + InputProps={{ + endAdornment: instance ? Utils.copyToClipboard(instance)} + > + + : null, + sx: { ...commonStyles.clearPadding, ...commonStyles.fieldContent }, + }} + />