Sha256: a87fd4c63c0bd873e133e0a4647a4582e77fb00b83b001901a21c0dc73227575

Contents?: true

Size: 1022 Bytes

Versions: 4

Compression:

Stored size: 1022 Bytes

Contents

// @flow
import React from 'react'; // eslint-disable-line no-unused-vars
import Panorama from 'material-ui/svg-icons/image/panorama';
import './index.scss';
import Asset from '../../../models/asset';
import Component from './Component';

export default {
    Component,
    name: 'ory/editor/core/content/image',
    version: '0.0.1',
    IconComponent: <Panorama />,
    text: 'Image',
    isInlineable: true,
    description: 'Loads an image from an url.',

    handleRemoveHotKey(ev, node) {
        if (node.content.state.assetId) {
            const asset = new Asset({ id: node.content.state.assetId });
            return asset.destroy();
        }
        return Promise.resolve(node);
    },

    // We need this because otherwise we lose hotkey focus on elements like spoilers.
    // This could probably be solved in an easier way by listening to window.document?

    handleFocus: (props: any, source: any, ref: HTMLElement) => {
        if (!ref) { return; }
        setTimeout(() => ref.focus());
    },
};

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hippo-fw-0.9.8 client/hippo/components/text-editor/image-plugin/index.js
hippo-fw-0.9.7 client/hippo/components/text-editor/image-plugin/index.js
hippo-fw-0.9.6 client/hippo/components/text-editor/image-plugin/index.js
hippo-fw-0.9.5 client/hippo/components/text-editor/image-plugin/index.js