Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide content input #77

Closed
noyainrain opened this issue Aug 23, 2019 · 2 comments
Closed

Provide content input #77

noyainrain opened this issue Aug 23, 2019 · 2 comments

Comments

@noyainrain
Copy link
Owner

Provide a text area with the ability to add web content (like a link, image or video). For convenience, if URL input is detected, show a preview along with the option to discard it.

@noyainrain
Copy link
Owner Author

A temporary workaround to prevent a link preview is to insert a single space before the URL (currently a URL is only recognized at the very beginning of the text).

@noyainrain noyainrain self-assigned this Apr 17, 2020
@noyainrain
Copy link
Owner Author

Server draft:

Previews
--------

Web :ref:`Resource` previews.

.. http:get:: /api/previews/(url)

   Get a description of the web :ref:`Resource` at *url*.

Client draft:

/**
 * Input for text and web :ref:`Resource` content.
 *
 * For convenience, when a URL is entered, the web resource is attached automatically.
 */
micro.compoments.contentinput.ContentInputElement = class extends HTMLElement {
    /**
     * Current value as object ``{text, resource}``.
     *
     * *text* is the text and *resource* the web :ref:`Resource` content. May both be ``null``.
     */
    get valueAsObject() {}

    /** See :attr:`HTMLInputElement.required`. */
    get required() {}

    /** See :attr:`HTMLInputElement.placeholder`. */
    get placeholder() {}

    /** Attach the web resource at *url*. */
    async attach(url) {}
};

/**
 * Extension for an input that detects when a URL is entered.
 *
 * .. attribute:: input
 *
 *    Extended :class:`HTMLInputElement` or :class:`HTMLTextAreaElement`.
 *
 * .. describe:: onurlinput
 *
 *    Event handler for ``urlinput``, dispatched when a *url* is entered.
 */
micro.compoments.contentinput.URLDetection = class {
    constructor(input) {}
};

UI draft:

UI draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant