Skip to content

Add a config option to disable home link in embeds#986

Merged
hatemhosny merged 3 commits into
developfrom
disable-home-link
May 27, 2026
Merged

Add a config option to disable home link in embeds#986
hatemhosny merged 3 commits into
developfrom
disable-home-link

Conversation

@hatemhosny
Copy link
Copy Markdown
Collaborator

@hatemhosny hatemhosny commented May 27, 2026

What type of PR is this? (check all applicable)

  • ✨ Feature

Description

A new config option disableHomeLink was added, which if set to true disables the link on LiveCodes logo ("Edit in LiveCodes") in embeds.

Related Tickets & Documents

#985 #980

Added to documentations?

  • 📓 docs (./docs)
  • 📕 storybook (./storybook)
  • 📜 README.md
  • 🙅 no documentation needed

Summary by CodeRabbit

  • New Features

    • Added disableHomeLink configuration option to disable the "Edit on LiveCodes" logo link in embedded playgrounds (defaults to false).
  • Documentation

    • Added documentation for the new disableHomeLink configuration option.
    • Updated contribution documentation with additional setup and testing requirements for new configuration properties.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for livecodes ready!

Name Link
🔨 Latest commit fd0789c
🔍 Latest deploy log https://app.netlify.com/projects/livecodes/deploys/6a1682ccfe01130008917b91
😎 Deploy Preview https://deploy-preview-986--livecodes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
14.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 1.09 MB

ℹ️ View Unchanged
Filename Size Change
build/404.html 1.45 kB 0 B
build/app.html 250 B 0 B
build/index.html 1.54 kB +2 B (+0.13%)
build/livecodes/app.css 23.5 kB 0 B
build/livecodes/app.js 113 kB +73 B (+0.06%)
build/livecodes/assets.js 8.67 kB +8 B (+0.09%)
build/livecodes/assets/noop.js 18 B 0 B
build/livecodes/assets/templates/diagrams-starter.html 2.19 kB 0 B
build/livecodes/backup.js 3.74 kB +2 B (+0.05%)
build/livecodes/blockly.js 15.1 kB 0 B
build/livecodes/broadcast.js 1.19 kB +1 B (+0.08%)
build/livecodes/bundle-types.js 4.41 kB 0 B
build/livecodes/code-to-image.js 9.18 kB +12 B (+0.13%)
build/livecodes/codejar.js 17.6 kB 0 B
build/livecodes/codemirror.js 16.1 kB 0 B
build/livecodes/compile.page.js 2.46 kB 0 B
build/livecodes/compile.worker.js 15.2 kB 0 B
build/livecodes/compiler-utils.js 3.17 kB 0 B
build/livecodes/custom-editor-utils.js 198 B 0 B
build/livecodes/deploy.js 6.91 kB -23 B (-0.33%)
build/livecodes/editor-settings.js 19.4 kB +9 B (+0.05%)
build/livecodes/embed-ui.js 5.51 kB -6 B (-0.11%)
build/livecodes/embed.js 91.2 kB -171 B (-0.19%)
build/livecodes/export.js 3.91 kB 0 B
build/livecodes/firebase.js 22.7 kB 0 B
build/livecodes/format.worker.js 14.4 kB -53 B (-0.37%)
build/livecodes/google-fonts.js 7.12 kB 0 B
build/livecodes/headless.js 79.8 kB +44 B (+0.06%)
build/livecodes/i18n-ar-language-info.json 5.34 kB 0 B
build/livecodes/i18n-ar-translation.json 9.34 kB 0 B
build/livecodes/i18n-bn-language-info.json 5.76 kB 0 B
build/livecodes/i18n-bn-translation.json 9.68 kB 0 B
build/livecodes/i18n-de-language-info.json 5.4 kB 0 B
build/livecodes/i18n-de-translation.json 9.47 kB 0 B
build/livecodes/i18n-en-language-info.json 4.63 kB 0 B
build/livecodes/i18n-en-translation.json 8.06 kB 0 B
build/livecodes/i18n-es-language-info.json 5.12 kB 0 B
build/livecodes/i18n-es-translation.json 9.19 kB 0 B
build/livecodes/i18n-fa-language-info.json 5.52 kB 0 B
build/livecodes/i18n-fa-translation.json 9.5 kB 0 B
build/livecodes/i18n-fr-language-info.json 5.31 kB 0 B
build/livecodes/i18n-fr-translation.json 9.45 kB 0 B
build/livecodes/i18n-hi-language-info.json 5.93 kB 0 B
build/livecodes/i18n-hi-translation.json 9.99 kB 0 B
build/livecodes/i18n-hu-language-info.json 5.29 kB 0 B
build/livecodes/i18n-hu-translation.json 9.38 kB 0 B
build/livecodes/i18n-id-language-info.json 4.87 kB 0 B
build/livecodes/i18n-id-translation.json 8.71 kB 0 B
build/livecodes/i18n-it-language-info.json 5.17 kB 0 B
build/livecodes/i18n-it-translation.json 9.26 kB 0 B
build/livecodes/i18n-ja-language-info.json 5.72 kB 0 B
build/livecodes/i18n-ja-translation.json 9.64 kB 0 B
build/livecodes/i18n-nl-language-info.json 5.07 kB 0 B
build/livecodes/i18n-nl-translation.json 8.91 kB 0 B
build/livecodes/i18n-pt-language-info.json 5.16 kB 0 B
build/livecodes/i18n-pt-translation.json 9.38 kB 0 B
build/livecodes/i18n-ru-language-info.json 5.7 kB 0 B
build/livecodes/i18n-ru-translation.json 10.3 kB 0 B
build/livecodes/i18n-tr-language-info.json 5.3 kB 0 B
build/livecodes/i18n-tr-translation.json 9.29 kB 0 B
build/livecodes/i18n-ur-language-info.json 5.97 kB 0 B
build/livecodes/i18n-ur-translation.json 9.81 kB 0 B
build/livecodes/i18n-zh-CN-language-info.json 5.01 kB 0 B
build/livecodes/i18n-zh-CN-translation.json 8.67 kB 0 B
build/livecodes/i18n.js 20.5 kB +13 B (+0.06%)
build/livecodes/import-src.js 17.9 kB 0 B
build/livecodes/import.js 16.3 kB +14 B (+0.09%)
build/livecodes/index.js 5.43 kB -7 B (-0.13%)
build/livecodes/lang-art-template-compiler.js 1.68 kB 0 B
build/livecodes/lang-assemblyscript-compiler.js 290 B 0 B
build/livecodes/lang-assemblyscript-script.js 386 B 0 B
build/livecodes/lang-astro-compiler.js 2.37 kB 0 B
build/livecodes/lang-clio-compiler.js 1.58 kB 0 B
build/livecodes/lang-commonlisp-script.js 123 B 0 B
build/livecodes/lang-cpp-script.js 1.96 kB 0 B
build/livecodes/lang-cpp-wasm-script.js 2.88 kB 0 B
build/livecodes/lang-csharp-wasm-script.js 2.21 kB 0 B
build/livecodes/lang-diagrams-compiler-esm.js 5.11 kB 0 B
build/livecodes/lang-dot-compiler.js 1.69 kB 0 B
build/livecodes/lang-ejs-compiler.js 1.66 kB 0 B
build/livecodes/lang-eta-compiler.js 1.68 kB 0 B
build/livecodes/lang-fennel-compiler.js 1.64 kB 0 B
build/livecodes/lang-gleam-compiler.js 3.12 kB 0 B
build/livecodes/lang-go-wasm-script.js 3.29 kB 0 B
build/livecodes/lang-haml-compiler.js 1.69 kB 0 B
build/livecodes/lang-handlebars-compiler.js 1.99 kB 0 B
build/livecodes/lang-imba-compiler.js 147 B 0 B
build/livecodes/lang-java-script.js 4.09 kB 0 B
build/livecodes/lang-jinja-compiler.js 1.67 kB 0 B
build/livecodes/lang-julia-script.js 3.32 kB 0 B
build/livecodes/lang-liquid-compiler.js 1.71 kB 0 B
build/livecodes/lang-lua-wasm-script.js 205 B 0 B
build/livecodes/lang-malina-compiler.js 2.98 kB 0 B
build/livecodes/lang-markdown-compiler.js 1.7 kB 0 B
build/livecodes/lang-markdown-script.js 1.47 kB 0 B
build/livecodes/lang-minizinc-script.js 2.09 kB 0 B
build/livecodes/lang-mustache-compiler.js 1.68 kB 0 B
build/livecodes/lang-nunjucks-compiler.js 2 kB 0 B
build/livecodes/lang-perl-script.js 268 B 0 B
build/livecodes/lang-php-wasm-script.js 347 B 0 B
build/livecodes/lang-postgresql-compiler-esm.js 1.76 kB 0 B
build/livecodes/lang-prolog-script.js 204 B 0 B
build/livecodes/lang-pug-compiler.js 371 B 0 B
build/livecodes/lang-python-wasm-script.js 1.89 kB 0 B
build/livecodes/lang-r-script-esm.js 2.47 kB 0 B
build/livecodes/lang-rescript-compiler-esm.js 2.19 kB 0 B
build/livecodes/lang-rescript-formatter.js 1.55 kB 0 B
build/livecodes/lang-riot-compiler.js 2.85 kB 0 B
build/livecodes/lang-ruby-wasm-script.js 1.75 kB 0 B
build/livecodes/lang-scss-compiler.js 1.85 kB 0 B
build/livecodes/lang-solid-compiler.js 263 B 0 B
build/livecodes/lang-sql-compiler.js 1.67 kB 0 B
build/livecodes/lang-sql-script.js 2.08 kB 0 B
build/livecodes/lang-svelte-compiler.js 4.72 kB 0 B
build/livecodes/lang-tcl-script.js 1.86 kB 0 B
build/livecodes/lang-teal-compiler.js 1.75 kB 0 B
build/livecodes/lang-twig-compiler.js 1.68 kB 0 B
build/livecodes/lang-vento-compiler.js 1.73 kB 0 B
build/livecodes/lang-vue-compiler.js 6.13 kB 0 B
build/livecodes/lang-vue2-compiler.js 3.5 kB 0 B
build/livecodes/lang-wat-compiler.js 348 B 0 B
build/livecodes/lang-wat-script.js 1.98 kB 0 B
build/livecodes/language-info.js 7.92 kB -5 B (-0.06%)
build/livecodes/monaco.js 20 kB 0 B
build/livecodes/open.js 6.24 kB +1 B (+0.02%)
build/livecodes/processor-lightningcss-compiler.js 1.91 kB 0 B
build/livecodes/processor-postcss-compiler.js 2.06 kB 0 B
build/livecodes/processor-tailwindcss-compiler.js 5.29 kB 0 B
build/livecodes/processor-unocss-compiler.js 355 B 0 B
build/livecodes/processor-windicss-compiler.js 450 B 0 B
build/livecodes/quill.css 697 B 0 B
build/livecodes/quill.js 5.86 kB 0 B
build/livecodes/resources.js 3.43 kB +3 B (+0.09%)
build/livecodes/result-utils.js 1.17 kB 0 B
build/livecodes/share.js 3.84 kB 0 B
build/livecodes/snippets.js 6.07 kB -2 B (-0.03%)
build/livecodes/sync-ui.js 3.29 kB 0 B
build/livecodes/sync.js 3.56 kB 0 B
build/livecodes/sync.worker.js 29.8 kB 0 B
build/livecodes/templates.js 27 kB 0 B
build/sdk/livecodes.js 4.39 kB 0 B
build/sdk/livecodes.umd.js 5.19 kB 0 B
build/sdk/package.json 456 B 0 B
build/sdk/preact.js 4.74 kB 0 B
build/sdk/react.js 4.77 kB 0 B
build/sdk/solid.js 4.91 kB 0 B
build/sdk/svelte.js 4.36 kB 0 B
build/sdk/vue.js 4.77 kB 0 B
build/sdk/web-components.js 5.8 kB 0 B

compressed-size-action

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Walkthrough

This PR adds a new disableHomeLink configuration option to LiveCodes embeds, enabling users to hide the "Edit on LiveCodes" logo link. The implementation includes the AppConfig type definition, configuration defaults and validation, conditional logo behavior in the embed, Storybook controls across all framework implementations, and complete user and contributor documentation.

Changes

disableHomeLink Configuration Feature

Layer / File(s) Summary
Type contract and default configuration
src/sdk/models.ts, src/livecodes/config/default-config.ts
AppConfig interface declares disableHomeLink: boolean option, and defaultConfig provides the default value of false.
Configuration validation and exposure
src/livecodes/config/validate-config.ts, src/livecodes/config/config.ts
validateConfig handles the new field during config processing, and getAppConfig includes it in the returned config snapshot.
Embed logo link behavior
src/livecodes/core.ts
configureEmbed applies conditional logo behavior: when disabled, the title is static "LiveCodes", cursor is default, and click only prevents default; otherwise, maintains prior i18n title and opens shared URL in new tab.
Storybook control definition and base story
storybook/common/arg-types.ts, storybook/_stories/EmbedOptions/config.ts
Arg-types adds boolean control metadata for config__disableHomeLink, and a shared story definition is provided for Storybook integration.
Framework-specific Storybook stories
storybook/preact/stories/EmbedOptions/config.stories.ts, storybook/react/stories/EmbedOptions/config.stories.ts, storybook/solid/src/solid.ts, storybook/solid/stories/EmbedOptions/config.stories.ts, storybook/svelte/stories/EmbedOptions/config.stories.ts, storybook/vue/stories/EmbedOptions/config.stories.ts, storybook/web-components/stories/EmbedOptions/config.stories.ts
New disableHomeLink story exports added across all framework implementations (Preact, React, Solid, Svelte, Vue, Web Components), with import reordering in Solid wrapper for linting compliance.
User and contributor documentation
docs/docs/configuration/configuration-object.mdx, docs/docs/contribution/config-system.mdx
User docs describe the boolean option and its effect on the logo link; contributor docs extend the config system guide with new checklist steps for Storybook arg-types, framework stories, and e2e test coverage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #985 — This PR directly implements the disableHomeLink configuration option requested to disable the "Edit on LiveCodes" link in embedded playgrounds, covering the complete feature implementation from model through behavior and documentation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Add a config option to disable home link in embeds' is clear, concise, and directly summarizes the primary change across all modified files, which implement a new disableHomeLink configuration option.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch disable-home-link

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/livecodes/core.ts (1)

5040-5040: ⚡ Quick win

Externalize the new tooltip/title string for i18n.

Line 5040 introduces a hardcoded user-facing string. Please route it through translateString (and add the locale key) to keep embed UI text localizable.

Suggested patch
-    logoLink.title = 'LiveCodes';
+    logoLink.title = window.deps.translateString('generic.embed.logoTitle', 'LiveCodes');

As per coding guidelines, src/livecodes/**/*.{ts,tsx,html} should “Export user-facing text strings for internationalization; run npm run i18n-export after adding new text”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/livecodes/core.ts` at line 5040, Replace the hardcoded title assignment
logoLink.title = 'LiveCodes' in src/livecodes/core.ts with a call to
translateString (e.g., logoLink.title =
translateString('livecodes.logo.title')), add the new locale key
"livecodes.logo.title" and its string to your i18n source (messages/*.json or
equivalent), ensure translateString is imported where logoLink is set, and run
npm run i18n-export to include the new text in the project extraction.
storybook/solid/src/solid.ts (1)

12-14: 💤 Low value

Consider using inline type modifier to avoid the eslint-disable.

The current approach splits runtime and type imports from livecodes into separate statements, requiring an eslint-disable comment. TypeScript supports inline type modifiers that would satisfy both the type-only import requirement and import grouping:

♻️ Refactor to consolidate imports
-import { createPlayground } from 'livecodes';
-// eslint-disable-next-line import/order
-import type { EmbedOptions, Playground } from 'livecodes';
+import { createPlayground, type EmbedOptions, type Playground } from 'livecodes';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@storybook/solid/src/solid.ts` around lines 12 - 14, The import split causes
an eslint-disable; consolidate the imports by importing the runtime symbol
createPlayground and the type-only symbols EmbedOptions and Playground in a
single statement using TypeScript's inline type modifier (e.g., import
createPlayground, { type EmbedOptions, type Playground } from 'livecodes') so
you can remove the eslint-disable comment; update the import that currently
references createPlayground and the separate type import to a single combined
import for createPlayground, EmbedOptions, and Playground.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/livecodes/core.ts`:
- Line 5040: Replace the hardcoded title assignment logoLink.title = 'LiveCodes'
in src/livecodes/core.ts with a call to translateString (e.g., logoLink.title =
translateString('livecodes.logo.title')), add the new locale key
"livecodes.logo.title" and its string to your i18n source (messages/*.json or
equivalent), ensure translateString is imported where logoLink is set, and run
npm run i18n-export to include the new text in the project extraction.

In `@storybook/solid/src/solid.ts`:
- Around line 12-14: The import split causes an eslint-disable; consolidate the
imports by importing the runtime symbol createPlayground and the type-only
symbols EmbedOptions and Playground in a single statement using TypeScript's
inline type modifier (e.g., import createPlayground, { type EmbedOptions, type
Playground } from 'livecodes') so you can remove the eslint-disable comment;
update the import that currently references createPlayground and the separate
type import to a single combined import for createPlayground, EmbedOptions, and
Playground.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d1e2e22a-989c-4a50-8c45-5617a0547124

📥 Commits

Reviewing files that changed from the base of the PR and between a20791d and fd0789c.

📒 Files selected for processing (16)
  • docs/docs/configuration/configuration-object.mdx
  • docs/docs/contribution/config-system.mdx
  • src/livecodes/config/config.ts
  • src/livecodes/config/default-config.ts
  • src/livecodes/config/validate-config.ts
  • src/livecodes/core.ts
  • src/sdk/models.ts
  • storybook/_stories/EmbedOptions/config.ts
  • storybook/common/arg-types.ts
  • storybook/preact/stories/EmbedOptions/config.stories.ts
  • storybook/react/stories/EmbedOptions/config.stories.ts
  • storybook/solid/src/solid.ts
  • storybook/solid/stories/EmbedOptions/config.stories.ts
  • storybook/svelte/stories/EmbedOptions/config.stories.ts
  • storybook/vue/stories/EmbedOptions/config.stories.ts
  • storybook/web-components/stories/EmbedOptions/config.stories.ts

@hatemhosny hatemhosny merged commit be1e338 into develop May 27, 2026
20 of 21 checks passed
@hatemhosny hatemhosny deleted the disable-home-link branch May 28, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant