nib-edit / nib Goto Github PK
View Code? Open in Web Editor NEWWysiwyg / Text editor components built using React and Prosemirror
Home Page: https://nib-edit.github.io/nib/
License: GNU General Public License v3.0
Wysiwyg / Text editor components built using React and Prosemirror
Home Page: https://nib-edit.github.io/nib/
License: GNU General Public License v3.0
Having default classes and allowing us to config the class names will be great as it provides more customization towards styling.
Details of the features to be added here.
Stick the menu bar on top when scroll.
Steps:
It does not works.
I'm a user of draft js and i can be able to convert html to draft.js content. So if HTML conversion supported i can ex-change my code with Nib. Nib seems is much cleaner and elegant. :)
http://www.nibedit.com/index.html
Demos font select closes immediately after mouse up, so selecting a font a is not possible.
I want to contribute and am having difficulties setting up the environment.
The toolbar should appear next to selected text.
code generated by converter:
<ahref="https://www.favie.tech">hello</a>
I wrote a visitor that replaces these nodes:
{ type: "paragraph" }
With:
{ type: "hardBreak" }
(because I need to preserve newlines)
But this is what convertToHTML
produces: <brundefined></br>
I wrote a visitor function to traverse the doc tree, to enable checking image nodes for "alt" attributes and then force users to provide a description, then add the attr to the list of attrs. Then I discovered that they get discarded, which appears to be caused by the "schema" in https://github.com/nib-edit/Nib/blob/master/packages/schema/src/nodes/image.js. I'd like to open a pull request to fix this, if you're interested.
In the introduction section of https://jpuri.github.io/Nib/ the two demo links go to 404 pages. The links in the sidebar work fine, so this is a very minor issue, just thought I'd give you the heads up ๐
<Editor config={{ plugins: { options: "inline block link list image history", image: { uploadCallback } }, toolbar: { options: "top", top: { block: { grouped }, options: "inline block link list image history" /* link */ } } }} onChange={this.handleChange2} defaultValue={defaultValue} styleConfig={{ editor: () => ({ height: "400px" }) }} />
I just use this.setstate to change the value of defaultValue without any effect
this.setState({
defaultValue: {
doc: {
type: 'doc',
content: []
}
}
});
To comply with WIA-ARIA rules I plan to implement following:
role
attribute to tag as applicable:button
- An input that allows for user-triggered actions when clicked or pressed.aria-disabled
, aria-label
, aria-haspopup
cell
- A cell in a tabular container.columnheader
- A cell containing header information for a column.dialog
- A dialog is a descendant window of the primary window of a web application. For HTML pages, the primary application window is the entire web document, i.e., the body element.aria-label
, Authors SHOULD focus an element in the modal dialog when it is displayed, and authors SHOULD manage focus of modal dialogs.
, aria-modal
heading
- A heading for a section of the page.aria-level
img
- A container for a collection of elements that form an image.aria-label
textbox
- A generic type of widget that allows user input.aria-placeholder
, aria-required
, aria-label
, aria-labelledby
, aria-disabled
,link
- An interactive reference to an internal or external resource that, when activated, causes the user agent to navigate to that resource.aria-disabled
, aria-label
list
- A section containing listitem elements. See related listbox.listitem
- A single item in a list or directory.option
- A selectable item in a select list.grid
- A composite widget containing a collection of one or more rows with one or more cells where some or all cells in the grid are focusable by using methods of two-dimensional navigation, such as directional arrow keys.aria-label
listbox
- A widget that allows the user to select one or more items from a list of choices.row
- A row of cells in a tabular container.rowheader
- A cell containing header information for a row in a grid.separator
- A divider that separates and distinguishes sections of content or groups of menuitems.table
- A section containing data arranged in rows and columns.toolbar
- A collection of commonly used function buttons or controls represented in compact visual form.Authors MUST supply a label on each toolbar when the application contains more than one toolbar.
Authors SHOULD ensure that elements with the role tooltip are referenced through the use of aria-describedby before or at the time the tooltip is displayed.
aria-readonly
, aria-required
, aria-label
, aria-labelledby
, aria-disabled
, aria-hidden
, aria-keyshortcuts
Image uploading doesn't appear to work on Windows OS in Chrome Browser, and on iOS in Safari Browser. I tried using the example from the docs website.
Hi,
I'm trying to integrate your great editor with Formik in React.
My code:
import React, { useState } from 'react';
import { Input, Textarea, ErrrorMessage } from '../forms/Input';
import { Formik, Form } from 'formik';
import { ButtonFullWidth } from '../forms/Button';
import { Spinner } from '../common/Icons';
import Editor from "nib-core";
interface IProps {
value: string;
cardContentAction?: any;
}
const ComplexityEdit: React.FC<IProps> = ({ value, cardContentAction }) => {
const [data, setData] = useState({ analysing: null });
let onSubmit = (values) => {
cardContentAction(values['complexity'])
};
const initialValue = {
complexity: value,
};
const MyEditor = () => <Editor />;
return (
<div>
<Formik
onSubmit={onSubmit}
initialValues={initialValue}
render={({ errors, status, touched, isSubmitting}) => (
<Form>
<Input name='complexity' component={MyEditor} />
<ButtonFullWidth type='submit'>Opslaan {isSubmitting && <Spinner />}</ButtonFullWidth>
</Form>
)}
/>
</div>
);
};
export default ComplexityEdit;
This is a functional component that gets it's data from value and sends it back via cardContentAction. It works fine with an input or textarea but I can't figure out how to use initialValues or send the data back when I press submit.
Input is just a simple styled-component Field from Formik
Hi,
When entering html outside of tags it errors out for some reason. Keeps saying something about a Za component?
I have a couple of screenshots attached.
https://codesandbox.io/s/elegant-surf-rzr8y?fontsize=14&hidenavigation=1&theme=dark
"nib-core": "^2.3.9",
It auto submit form after pressing on any button on toolbar
Somehow this:
<p ><br></p><p >
Turns into this:
<p ><br ><br></br></p><p >
By doing something as simple as focusing away from the editor and back.
Rick
[] overflow should scroll properly
[] it should be possible to set height and default height should also work well
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.