-
Notifications
You must be signed in to change notification settings - Fork 84
feat: support glob patterns in editor.fileTree.allowEdits
#332
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
eef08aa
feat(runtime): support glob patterns in `editor.fileTree.allowEdits`
AriPerkkio 5962354
feat(react): add `allowEditPatterns` to `FileTree`
AriPerkkio d07d47c
test: verify `allowEdits` as glob patterns
AriPerkkio c4b359b
feat(react): use radix dialog on `<ContextMenu>` errors
AriPerkkio 78292c0
Merge remote-tracking branch 'upstream/main' into feat/allow-edits-globs
AriPerkkio 3d75f4b
fix: code review
AriPerkkio 428bc1b
fix: code review
AriPerkkio 5bd7a03
fix: topBar-<variant>Button to just <variant>Button
AriPerkkio 24853cf
fix: code review
AriPerkkio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
e2e/src/content/tutorial/tests/file-tree/allow-edits-glob/_files/first-level/file.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'File in first level'; |
1 change: 1 addition & 0 deletions
1
...content/tutorial/tests/file-tree/allow-edits-glob/_files/first-level/second-level/file.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'File in second level'; |
18 changes: 18 additions & 0 deletions
18
e2e/src/content/tutorial/tests/file-tree/allow-edits-glob/content.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
type: lesson | ||
title: Allow Edits Glob | ||
previews: false | ||
editor: | ||
fileTree: | ||
allowEdits: | ||
# Items in root | ||
- "/*" | ||
# Only "allowed-filename-only.js" inside "/first-level" folder | ||
- "/first-level/allowed-filename-only.js" | ||
# Anything inside "second-level" folders anywhere | ||
- "**/second-level/**" | ||
terminal: | ||
panels: terminal | ||
--- | ||
|
||
# File Tree test - Allow Edits Glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { defineConfig } from '@tutorialkit/theme'; | ||
|
||
export default defineConfig({ | ||
// add your UnoCSS config here: https://unocss.dev/guide/config-file | ||
// required for TutorialKit monorepo development mode | ||
content: { | ||
pipeline: { | ||
include: '**', | ||
}, | ||
}, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { type ComponentProps, forwardRef, type Ref } from 'react'; | ||
import { classNames } from './utils/classnames.js'; | ||
|
||
interface Props extends ComponentProps<'button'> { | ||
variant?: 'primary' | 'secondary'; | ||
} | ||
|
||
export const Button = forwardRef(({ className, variant = 'primary', ...props }: Props, ref: Ref<HTMLButtonElement>) => { | ||
return ( | ||
<button | ||
ref={ref} | ||
{...props} | ||
className={classNames( | ||
className, | ||
'flex items-center font-500 text-sm ml-2 px-4 py-1 rounded-md disabled:opacity-32', | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
variant === 'primary' && | ||
'bg-tk-elements-primaryButton-backgroundColor text-tk-elements-primaryButton-textColor', | ||
|
||
!props.disabled && | ||
variant === 'primary' && | ||
'hover:bg-tk-elements-primaryButton-backgroundColorHover hover:text-tk-elements-primaryButton-textColorHover', | ||
|
||
variant === 'secondary' && | ||
'bg-tk-elements-secondaryButton-backgroundColor text-tk-elements-secondaryButton-textColor', | ||
|
||
!props.disabled && | ||
variant === 'secondary' && | ||
'hover:bg-tk-elements-secondaryButton-backgroundColorHover hover:text-tk-elements-secondaryButton-textColorHover', | ||
)} | ||
/> | ||
); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.