Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@uiw/codemirror-extensions-events
Advanced tools
Events Extensions for CodeMirror6.
npm install @uiw/codemirror-extensions-events --save
import * as events from '@uiw/codemirror-extensions-events';
import { element } from '@uiw/codemirror-extensions-events';
const extension1 = events.scroll({
scroll: (evn) => {
/* ... */
},
});
const extension1 = events.dom({
click: (evn) => {
/* ... */
},
});
const extension2 = events.content({
focus: (evn) => {
/* ... */
},
blur: (evn) => {
/* ... */
},
});
const extension3 = element({
type: 'content',
props: {
inputMode: 'none',
},
});
import CodeMirror from '@uiw/react-codemirror';
import * as events from '@uiw/codemirror-extensions-events';
import { element } from '@uiw/codemirror-extensions-events';
function App() {
const [scrollTop, setScrollTop] = useState(0);
const eventExt = events.scroll({
scroll: (evn) => {
setScrollTop(evn.target.scrollTop);
},
});
const eventExt2 = events.content({
focus: (evn) => {
console.log('focus');
},
blur: (evn) => {
console.log('blur');
},
});
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
extensions={[
element({
type: 'content',
props: {
inputMode: 'none',
},
}),
eventExt,
eventExt2,
]}
/>
);
}
export default App;
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import * as events from '@uiw/codemirror-extensions-events';
const eventExt = events.content({
focus: (evn) => {
console.log('focus');
},
blur: (evn) => {
console.log('blur');
},
});
const state = EditorState.create({
doc: 'my source code',
extensions: [eventExt],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});
import { ViewPlugin, EditorView } from '@codemirror/view';
export declare type Events<K extends keyof HTMLElementEventMap> = Record<
K,
(this: HTMLElement, event: HTMLElementEventMap[K]) => void
>;
/**
* The DOM element that can be styled to scroll.
* (Note that it may not have been, so you can't assume this is scrollable.)
*/
export declare function dom<T extends keyof HTMLElementEventMap>(
opts: Events<T>,
): ViewPlugin<{
dom?: HTMLElement | undefined;
view: EditorView;
destroy(): void;
}>;
/**
* The DOM element that wraps the entire editor view.
*/
export declare function scroll<T extends keyof HTMLElementEventMap>(
opts: Events<T>,
): ViewPlugin<{
dom?: HTMLElement | undefined;
view: EditorView;
destroy(): void;
}>;
/**
* The editable DOM element holding the editor content.
* You should not, usually, interact with this content directly though the DOM,
* since the editor will immediately undo most of the changes you make.
*/
export declare function content<T extends keyof HTMLElementEventMap>(
opts: Events<T>,
): ViewPlugin<{
dom?: HTMLElement | undefined;
view: EditorView;
destroy(): void;
}>;
As always, thanks to our amazing contributors!
Made with github-action-contributors.
Licensed under the MIT License.
FAQs
Events Extensions for CodeMirror6.
The npm package @uiw/codemirror-extensions-events receives a total of 7,446 weekly downloads. As such, @uiw/codemirror-extensions-events popularity was classified as popular.
We found that @uiw/codemirror-extensions-events demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.