diff --git a/.changeset/clean-pets-push.md b/.changeset/clean-pets-push.md new file mode 100644 index 00000000..cb15450c --- /dev/null +++ b/.changeset/clean-pets-push.md @@ -0,0 +1,5 @@ +--- +'playroom': patch +--- + +Ensure favicon is displayed on Preview links. diff --git a/.changeset/small-rules-bake.md b/.changeset/small-rules-bake.md new file mode 100644 index 00000000..ed40b603 --- /dev/null +++ b/.changeset/small-rules-bake.md @@ -0,0 +1,5 @@ +--- +'playroom': minor +--- + +Remove keybinding for copying Playroom link to clipboard. diff --git a/lib/makeWebpackConfig.js b/lib/makeWebpackConfig.js index 3051fbf9..98698e16 100644 --- a/lib/makeWebpackConfig.js +++ b/lib/makeWebpackConfig.js @@ -178,6 +178,7 @@ module.exports = async (playroomConfig, options) => { chunksSortMode: 'none', chunks: ['preview'], filename: 'preview/index.html', + favicon: path.join(__dirname, '../images/favicon.png'), publicPath: '../', }), new VanillaExtractPlugin({ diff --git a/src/Playroom/CodeEditor/CodeEditor.tsx b/src/Playroom/CodeEditor/CodeEditor.tsx index 07eefd1b..a61d64c1 100644 --- a/src/Playroom/CodeEditor/CodeEditor.tsx +++ b/src/Playroom/CodeEditor/CodeEditor.tsx @@ -298,15 +298,6 @@ export const CodeEditor = ({ ['Shift-Ctrl-R']: false, // override default keybinding ['Cmd-Option-F']: false, // override default keybinding ['Shift-Cmd-Option-F']: false, // override default keybinding - [`Shift-${keymapModifierKey}-C`]: () => { - dispatch({ - type: 'copyToClipboard', - payload: { - url: window.location.href, - trigger: 'toolbarItem', - }, - }); - }, }, }} /> diff --git a/src/Playroom/SettingsPanel/SettingsPanel.tsx b/src/Playroom/SettingsPanel/SettingsPanel.tsx index 7dabdc3c..99c6912b 100644 --- a/src/Playroom/SettingsPanel/SettingsPanel.tsx +++ b/src/Playroom/SettingsPanel/SettingsPanel.tsx @@ -32,7 +32,6 @@ const getKeyBindings = () => { 'Wrap selection in tag': [metaKeySymbol, shiftKeySymbol, ','], 'Format code': [metaKeySymbol, 'S'], 'Insert snippet': [metaKeySymbol, 'K'], - 'Copy Playroom link': [metaKeySymbol, shiftKeySymbol, 'C'], 'Select next occurrence': [metaKeySymbol, 'D'], 'Jump to line number': [metaKeySymbol, 'G'], 'Swap line up': [altKeySymbol, '↑'], diff --git a/src/Playroom/Toolbar/Toolbar.tsx b/src/Playroom/Toolbar/Toolbar.tsx index 389401bc..801d3acd 100644 --- a/src/Playroom/Toolbar/Toolbar.tsx +++ b/src/Playroom/Toolbar/Toolbar.tsx @@ -135,7 +135,7 @@ export default ({ themes: allThemes, widths: allWidths, snippets }: Props) => {
diff --git a/src/preview.js b/src/preview.js index efae4509..400b5ec7 100644 --- a/src/preview.js +++ b/src/preview.js @@ -1,9 +1,22 @@ import { renderElement } from './render'; import Preview from './Playroom/Preview'; +import faviconPath from '../images/favicon.png'; +import faviconInvertedPath from '../images/favicon-inverted.png'; const outlet = document.createElement('div'); document.body.appendChild(outlet); +const selectedElement = document.head.querySelector('link[rel="icon"]'); +const favicon = window.matchMedia('(prefers-color-scheme: dark)').matches + ? faviconInvertedPath + : faviconPath; + +const formattedFavicon = `../${favicon}`; + +if (selectedElement) { + selectedElement.setAttribute('href', formattedFavicon); +} + const renderPreview = ({ themes = require('./themes'), components = require('./components'),