Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knex Playground #6059

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Knex Playground #6059

wants to merge 11 commits into from

Conversation

dgadelha
Copy link

knex-playground integrated into Knex's official docs

Desktop Mobile

Warning

I currently need help on making light mode work with the editor

Any code feedback is also welcome, I have almost zero knowledge with Vue

Copy link
Member

@rluvaton rluvaton left a comment

Choose a reason for hiding this comment

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

Thanks, will continue the review later

try {
const knex = Knex({ client: dialect.value });

output += eval(code.value).toQuery();
Copy link
Member

Choose a reason for hiding this comment

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

Why eval?

Copy link
Author

Choose a reason for hiding this comment

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

We receive the code as string, and we need to call the toQuery() method in the code to get the resulting query, I see this method as the only way to achieve this

Copy link
Member

Choose a reason for hiding this comment

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

Too risky, lets try find another way

Copy link
Member

Choose a reason for hiding this comment

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

You might wanna look how https://github.com/wirekang/kysely-playground does it

Copy link
Member

Choose a reason for hiding this comment

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

They are using iframe which is better approach

Copy link
Member

Choose a reason for hiding this comment

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

  1. Does it support multi instances?
  2. Can you provide option for having prefilled text + specific language? I want to integrate it in the docs for each example

Copy link
Author

Choose a reason for hiding this comment

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

it should probably support multi instances, but you should probably attempt to measure page performance, because it instantiates two monaco-editors for each instance

docs/.vitepress/theme/Playground.vue Outdated Show resolved Hide resolved
@rluvaton
Copy link
Member

I've fixed the PR to support dark mode + light mode

@coveralls
Copy link

coveralls commented Apr 23, 2024

Coverage Status

coverage: 92.843%. remained the same
when pulling 98f760e on dgadelha:master
into 9659a20 on knex:master.

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.

None yet

3 participants