Skip to content

Commit

Permalink
feat(components): allow to pass FEEL language context via provider
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Jan 24, 2025
1 parent 40cb7ac commit ada0449
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/entries/FEEL/Feel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import FeelIcon from './FeelIcon';

import { FEEL_POPUP_WIDTH } from './FeelPopup';

import { FeelPopupContext } from './context';
import { FeelLanguageContext, FeelPopupContext } from './context';

import { ToggleSwitch } from '../ToggleSwitch';

Expand Down Expand Up @@ -67,6 +67,8 @@ function FeelTextfieldComponent(props) {

const [ focus, _setFocus ] = useState(undefined);

const languageContext = useContext(FeelLanguageContext);

const {
open: openPopup,
source: popupSource
Expand Down Expand Up @@ -249,6 +251,7 @@ function FeelTextfieldComponent(props) {
placeholder={ placeholder }
value={ feelOnlyValue }
variables={ variables }
languageContext={ languageContext }
ref={ editorRef }
tooltipContainer={ tooltipContainer }
/> :
Expand Down
9 changes: 9 additions & 0 deletions src/components/entries/FEEL/context/FeelLanguageContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
createContext
} from 'preact';

const FeelLanguageContext = createContext({
dialect: 'expression'
});

export default FeelLanguageContext;
4 changes: 3 additions & 1 deletion src/components/entries/FEEL/context/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { default as FeelPopupContext } from './FeelPopupContext';
export { default as FeelPopupContext } from './FeelPopupContext';

export { default as FeelLanguageContext } from './FeelLanguageContext';

0 comments on commit ada0449

Please sign in to comment.