How to use the @remirror/core.isPlainObject function in @remirror/core

To help you get started, we’ve selected a few @remirror/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / extension-emoji / src / emoji-utils.ts View on Github external
export const isValidEmojiObject = (value: unknown): value is EmojiObject =>
  bool(isPlainObject(value) && isEmojiName(value.name));
export const aliasToName = (name: AliasNames) => aliasObject[name];
github ifiokjr / remirror / @remirror / extension-mention / src / mention-utils.ts View on Github external
export const isValidMentionAttrs = (attrs?: Attrs): attrs is MentionExtensionAttrs =>
  bool(attrs && isPlainObject(attrs) && attrs.id && attrs.label);
github ifiokjr / remirror / @remirror / react / src / components / remirror.tsx View on Github external
private renderClonedElement(element: JSX.Element, rootProps?: GetRootPropsConfig | boolean) {
    const { children, ...rest } = getElementProps(element);
    const props = isPlainObject(rootProps) ? { ...rootProps, ...rest } : rest;

    return cloneElement(element, this.internalGetRootProps(props, this.renderChildren(children)));
  }
github ifiokjr / remirror / @remirror / react-renderer / src / react-serializer.tsx View on Github external
public static renderSpec(structure: DOMOutputSpec, wraps?: ReactNode): ReactNode {
    if (isString(structure)) {
      return structure;
    }

    const Component = structure[0];
    const props: PlainObject = Object.create(null);
    const attrs = structure[1];
    const children: ReactNode[] = [];
    let currentIndex = 1;
    if (isPlainObject(attrs) && !isArray(attrs)) {
      currentIndex = 2;
      for (const name in attrs) {
        if (attrs[name] != null) {
          props[name] = attrs[name];
        }
      }
    }

    for (let ii = currentIndex; ii < structure.length; ii++) {
      const child = structure[ii];
      if (child === 0) {
        if (ii < structure.length - 1 || ii > currentIndex) {
          throw new RangeError('Content hole (0) must be the only child of its parent node');
        }
        return jsx(Component, mapProps(props), wraps);
      }