@elastic/eui
Version:
Elastic UI Component Library
485 lines (480 loc) • 34 kB
JavaScript
var _excluded = ["className", "editorId", "value", "onChange", "height", "maxHeight", "autoExpandPreview", "parsingPluginList", "processingPluginList", "uiPlugins", "onParse", "errors", "aria-label", "aria-labelledby", "aria-describedby", "initialViewMode", "dropHandlers", "markdownFormatProps", "placeholder", "readOnly", "toolbarProps", "showFooter"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
import PropTypes from "prop-types";
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React, { createElement, useEffect, useImperativeHandle, useMemo, useState, useCallback, useRef, forwardRef } from 'react';
import unified from 'unified';
import classNames from 'classnames';
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
import { EuiModal } from '../modal';
import { EuiResizeObserver } from '../observer/resize_observer';
import MarkdownActions, { insertText as _insertText } from './markdown_actions';
import { EuiMarkdownEditorToolbar } from './markdown_editor_toolbar';
import { EuiMarkdownEditorTextArea } from './markdown_editor_text_area';
import { EuiMarkdownFormat } from './markdown_format';
import { EuiMarkdownEditorDropZone } from './markdown_editor_drop_zone';
import { MODE_EDITING, MODE_VIEWING } from './markdown_modes';
import { EuiMarkdownContext } from './markdown_context';
import { defaultParsingPlugins, defaultProcessingPlugins, defaultUiPlugins } from './plugins/markdown_default_plugins';
import { euiMarkdownEditorStyles } from './markdown_editor.styles';
import { jsx as ___EmotionJSX } from "@emotion/react";
// TODO I wanted to use the useCombinedRefs
// but I can't because it's not allowed to use react hooks
// inside a callback.
var mergeRefs = function mergeRefs() {
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
refs[_key] = arguments[_key];
}
var filteredRefs = refs.filter(Boolean);
if (!filteredRefs.length) return null;
if (filteredRefs.length === 0) return filteredRefs[0];
return function (inst) {
var _iterator = _createForOfIteratorHelper(filteredRefs),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ref = _step.value;
if (typeof ref === 'function') {
ref(inst);
} else if (ref) {
ref.current = inst;
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
};
};
function isNewLine(char) {
if (char == null) return true;
return !!char.match(/[\r\n]/);
}
function padWithNewlinesIfNeeded(textarea, text) {
var selectionStart = textarea.selectionStart;
var selectionEnd = textarea.selectionEnd;
// block parsing requires two leading new lines and none trailing, but we add an extra trailing line for readability
var isPrevNewLine = isNewLine(textarea.value[selectionStart - 1]);
var isPrevPrevNewLine = isNewLine(textarea.value[selectionStart - 2]);
var isNextNewLine = isNewLine(textarea.value[selectionEnd]);
// pad text with newlines as needed
text = "".concat(isPrevNewLine ? '' : '\n').concat(isPrevPrevNewLine ? '' : '\n').concat(text).concat(isNextNewLine ? '' : '\n');
return text;
}
export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
var className = _ref.className,
_editorId = _ref.editorId,
value = _ref.value,
_onChange = _ref.onChange,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 250 : _ref$height,
_ref$maxHeight = _ref.maxHeight,
maxHeight = _ref$maxHeight === void 0 ? 500 : _ref$maxHeight,
_ref$autoExpandPrevie = _ref.autoExpandPreview,
autoExpandPreview = _ref$autoExpandPrevie === void 0 ? true : _ref$autoExpandPrevie,
_ref$parsingPluginLis = _ref.parsingPluginList,
parsingPluginList = _ref$parsingPluginLis === void 0 ? defaultParsingPlugins : _ref$parsingPluginLis,
_ref$processingPlugin = _ref.processingPluginList,
processingPluginList = _ref$processingPlugin === void 0 ? defaultProcessingPlugins : _ref$processingPlugin,
_ref$uiPlugins = _ref.uiPlugins,
uiPlugins = _ref$uiPlugins === void 0 ? defaultUiPlugins : _ref$uiPlugins,
onParse = _ref.onParse,
_ref$errors = _ref.errors,
errors = _ref$errors === void 0 ? [] : _ref$errors,
ariaLabel = _ref['aria-label'],
ariaLabelledBy = _ref['aria-labelledby'],
ariaDescribedBy = _ref['aria-describedby'],
_ref$initialViewMode = _ref.initialViewMode,
initialViewMode = _ref$initialViewMode === void 0 ? MODE_EDITING : _ref$initialViewMode,
_ref$dropHandlers = _ref.dropHandlers,
dropHandlers = _ref$dropHandlers === void 0 ? [] : _ref$dropHandlers,
markdownFormatProps = _ref.markdownFormatProps,
placeholder = _ref.placeholder,
readOnly = _ref.readOnly,
toolbarProps = _ref.toolbarProps,
_ref$showFooter = _ref.showFooter,
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
rest = _objectWithoutProperties(_ref, _excluded);
var _useState = useState(initialViewMode),
_useState2 = _slicedToArray(_useState, 2),
viewMode = _useState2[0],
setViewMode = _useState2[1];
var editorId = useGeneratedHtmlId({
conditionalId: _editorId
});
var _useState3 = useState(undefined),
_useState4 = _slicedToArray(_useState3, 2),
pluginEditorPlugin = _useState4[0],
setPluginEditorPlugin = _useState4[1];
var toolbarPlugins = _toConsumableArray(uiPlugins);
var markdownActions = useMemo(function () {
return new MarkdownActions(editorId, toolbarPlugins);
},
// toolbarPlugins _is_ accounted for
// eslint-disable-next-line react-hooks/exhaustive-deps
[editorId, toolbarPlugins.map(function (_ref2) {
var name = _ref2.name;
return name;
}).join(',')]);
var parser = useMemo(function () {
var Compiler = function Compiler(tree) {
return tree;
};
function identityCompiler() {
this.Compiler = Compiler;
}
return unified().use(parsingPluginList).use(identityCompiler);
}, [parsingPluginList]);
var _useMemo = useMemo(function () {
try {
var _parsed = parser.processSync(value);
return [_parsed, null];
} catch (e) {
return [null, e];
}
}, [parser, value]),
_useMemo2 = _slicedToArray(_useMemo, 2),
parsed = _useMemo2[0],
parseError = _useMemo2[1];
var isPreviewing = viewMode === MODE_VIEWING;
var isEditing = viewMode === MODE_EDITING;
var replaceNode = useCallback(function (position, next) {
var leading = value.substring(0, position.start.offset);
var trailing = value.substring(position.end.offset);
_onChange("".concat(leading).concat(next).concat(trailing));
}, [value, _onChange]);
var contextValue = useMemo(function () {
return {
openPluginEditor: readOnly ? function () {} : function (plugin) {
return setPluginEditorPlugin(function () {
return plugin;
});
},
replaceNode: readOnly ? function () {} : replaceNode,
readOnly: readOnly
};
}, [replaceNode, readOnly]);
var _useState5 = useState(),
_useState6 = _slicedToArray(_useState5, 2),
selectedNode = _useState6[0],
setSelectedNode = _useState6[1];
var textareaRef = useRef(null);
useEffect(function () {
if (textareaRef == null) return;
if (parsed == null) return;
var getCursorNode = function getCursorNode() {
var _parsed$result;
var _ref3 = textareaRef.current,
selectionStart = _ref3.selectionStart;
var node = (_parsed$result = parsed.result) !== null && _parsed$result !== void 0 ? _parsed$result : parsed.contents;
outer: while (true) {
if (node.children) {
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
if (child.position && child.position.start.offset < selectionStart && selectionStart < child.position.end.offset) {
if (child.type === 'text') break outer; // don't dive into `text` nodes
node = child;
continue outer;
}
}
}
break;
}
setSelectedNode(node);
};
// `parsed` changed, which means the node at the cursor may be different
// e.g. from clicking a toolbar button
getCursorNode();
var textarea = textareaRef.current;
textarea.addEventListener('keyup', getCursorNode);
textarea.addEventListener('mouseup', getCursorNode);
return function () {
textarea.removeEventListener('keyup', getCursorNode);
textarea.removeEventListener('mouseup', getCursorNode);
};
}, [parsed]);
useEffect(function () {
if (onParse) {
var _parsed$result2;
var messages = parsed ? parsed.messages : [];
var ast = parsed ? (_parsed$result2 = parsed.result) !== null && _parsed$result2 !== void 0 ? _parsed$result2 : parsed.contents : null;
onParse(parseError, {
messages: messages,
ast: ast
});
}
}, [onParse, parsed, parseError]);
useImperativeHandle(ref, function () {
return {
textarea: textareaRef.current,
replaceNode: replaceNode
};
}, [replaceNode]);
var textarea = textareaRef.current;
var previewRef = useRef(null);
var editorToolbarRef = useRef(null);
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
hasUnacceptedItems = _React$useState2[0],
setHasUnacceptedItems = _React$useState2[1];
var _useState7 = useState(height),
_useState8 = _slicedToArray(_useState7, 2),
currentHeight = _useState8[0],
setCurrentHeight = _useState8[1];
var _useState9 = useState(0),
_useState10 = _slicedToArray(_useState9, 2),
editorFooterHeight = _useState10[0],
setEditorFooterHeight = _useState10[1];
var _useState11 = useState(0),
_useState12 = _slicedToArray(_useState11, 2),
editorToolbarHeight = _useState12[0],
setEditorToolbarHeight = _useState12[1];
var styles = useEuiMemoizedStyles(euiMarkdownEditorStyles);
var cssStyles = [styles.euiMarkdownEditor, height === 'full' && styles.fullHeight];
var classes = classNames('euiMarkdownEditor', {
'euiMarkdownEditor-isPreviewing': isPreviewing
}, className);
var classesPreview = classNames('euiMarkdownEditorPreview', {
'euiMarkdownEditorPreview-isReadOnly': readOnly
});
var onResize = function onResize() {
if (textarea && isEditing && height !== 'full') {
var resizedTextareaHeight = textarea.offsetHeight + editorFooterHeight;
setCurrentHeight(resizedTextareaHeight);
}
};
useEffect(function () {
setEditorToolbarHeight(editorToolbarRef.current.offsetHeight);
}, [setEditorToolbarHeight]);
useEffect(function () {
if (height === 'full' || currentHeight === 'full') return;
if (isPreviewing && autoExpandPreview && previewRef.current.scrollHeight > currentHeight) {
// scrollHeight does not include the border or margin
// so we ask for the computed value for those,
// which is always in pixels because getComputedValue
// returns the resolved values
var elementComputedStyle = window.getComputedStyle(previewRef.current);
var borderWidth = parseFloat(elementComputedStyle.borderTopWidth) + parseFloat(elementComputedStyle.borderBottomWidth);
var marginWidth = parseFloat(elementComputedStyle.marginTop) + parseFloat(elementComputedStyle.marginBottom);
// then add an extra pixel for safety and because the scrollHeight value is rounded
var extraHeight = borderWidth + marginWidth + 1;
setCurrentHeight(previewRef.current.scrollHeight + extraHeight);
}
}, [currentHeight, isPreviewing, height, autoExpandPreview]);
var previewHeight = height === 'full' ? "calc(100% - ".concat(editorFooterHeight, "px)") : currentHeight;
var textAreaHeight = height === 'full' ? '100%' : "calc(".concat(height - editorFooterHeight, "px)");
var textAreaMaxHeight = height !== 'full' ? "".concat(maxHeight - editorFooterHeight, "px") : '';
// safari needs this calc when the height is set to full
var editorToggleContainerHeight = "calc(100% - ".concat(editorToolbarHeight, "px)");
return ___EmotionJSX(EuiMarkdownContext.Provider, {
value: contextValue
}, ___EmotionJSX("div", _extends({
className: classes,
css: cssStyles
}, rest), ___EmotionJSX(EuiMarkdownEditorToolbar, _extends({
ref: editorToolbarRef,
selectedNode: selectedNode,
markdownActions: markdownActions,
onClickPreview: function onClickPreview() {
return setViewMode(isPreviewing ? MODE_EDITING : MODE_VIEWING);
},
viewMode: viewMode,
uiPlugins: toolbarPlugins
}, toolbarProps)), isPreviewing && ___EmotionJSX("div", {
ref: previewRef,
className: classesPreview,
css: styles.euiMarkdownEditorPreview,
style: {
height: previewHeight
}
}, ___EmotionJSX(EuiMarkdownFormat, _extends({
parsingPluginList: parsingPluginList,
processingPluginList: processingPluginList
}, markdownFormatProps), value)), ___EmotionJSX("div", {
className: "euiMarkdownEditor__toggleContainer",
style: {
height: editorToggleContainerHeight,
display: isPreviewing ? 'none' : undefined
}
}, ___EmotionJSX(EuiMarkdownEditorDropZone, {
setEditorFooterHeight: setEditorFooterHeight,
isEditing: isEditing,
dropHandlers: dropHandlers,
insertText: function insertText(text, config) {
if (config.block) {
text = padWithNewlinesIfNeeded(textareaRef.current, text);
}
var originalSelectionStart = textareaRef.current.selectionStart;
var newSelectionPoint = originalSelectionStart + text.length;
_insertText(textareaRef.current, {
text: text,
selectionStart: newSelectionPoint,
selectionEnd: newSelectionPoint
});
},
showFooter: showFooter,
uiPlugins: toolbarPlugins,
errors: errors,
hasUnacceptedItems: hasUnacceptedItems,
setHasUnacceptedItems: setHasUnacceptedItems
}, ___EmotionJSX(EuiResizeObserver, {
onResize: onResize
}, function (resizeRef) {
return ___EmotionJSX(EuiMarkdownEditorTextArea, {
height: textAreaHeight,
maxHeight: textAreaMaxHeight,
ref: mergeRefs(textareaRef, resizeRef),
id: editorId,
onChange: function onChange(e) {
return _onChange(e.target.value);
},
value: value,
onFocus: function onFocus() {
return setHasUnacceptedItems(false);
},
placeholder: placeholder,
readOnly: readOnly,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
'aria-describedby': ariaDescribedBy
});
})), pluginEditorPlugin && ___EmotionJSX(EuiModal, {
onClose: function onClose() {
return setPluginEditorPlugin(undefined);
}
}, /*#__PURE__*/createElement(pluginEditorPlugin.editor, {
node: selectedNode && selectedNode.type === pluginEditorPlugin.name ? selectedNode : null,
onCancel: function onCancel() {
return setPluginEditorPlugin(undefined);
},
onSave: function onSave(markdown, config) {
if (selectedNode && selectedNode.type === pluginEditorPlugin.name && selectedNode.position) {
// modifying an existing node
textareaRef.current.setSelectionRange(selectedNode.position.start.offset, selectedNode.position.end.offset);
} else {
// creating a new node
if (config.block) {
// inject newlines if needed
markdown = padWithNewlinesIfNeeded(textareaRef.current, markdown);
}
}
_insertText(textareaRef.current, {
text: markdown,
selectionStart: undefined,
selectionEnd: undefined
});
setPluginEditorPlugin(undefined);
}
})))));
});
EuiMarkdownEditor.propTypes = {
className: PropTypes.string,
/** aria-label OR aria-labelledby must be set */"aria-label": PropTypes.string,
"data-test-subj": PropTypes.string,
css: PropTypes.any,
/** aria-label OR aria-labelledby must be set */"aria-labelledby": PropTypes.string,
/** ID of an element describing the text editor, useful for associating error messages */"aria-describedby": PropTypes.string,
/** a unique ID to attach to the textarea. If one isn't provided, a random one
* will be generated */
editorId: PropTypes.string,
/** A markdown content */value: PropTypes.string.isRequired,
/** callback function when markdown content is modified */onChange: PropTypes.func.isRequired,
/**
* Sets the current display mode to a read-only state. All editing gets resctricted.
*/
readOnly: PropTypes.bool,
/**
* Sets the `height` in pixels of the editor/preview area or pass `full` to allow
* the EuiMarkdownEditor to fill the height of its container.
* When in `full` mode the vertical resize is not allowed.
*/
height: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf(["full"])]),
/**
* Sets the `max-height` in pixels of the editor/preview area.
* It has no effect when the `height` is set to `full`.
*/
maxHeight: PropTypes.number,
/**
* Automatically adjusts the preview height to fit all the content and avoid a scrollbar.
*/
autoExpandPreview: PropTypes.bool,
/** plugins to identify new syntax and parse it into an AST node */parsingPluginList: PropTypes.any,
/** plugins to process the markdown AST nodes into a React nodes */processingPluginList: PropTypes.any,
/** defines UI for plugins' buttons in the toolbar as well as any modals or extra UI that provides content to the editor */uiPlugins: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
button: PropTypes.shape({
label: PropTypes.string.isRequired,
iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "addToDashboard", "advancedSettingsApp", "agentApp", "aggregate", "alignBottom", "alignBottomLeft", "alignBottomRight", "alignCenterHorizontal", "alignCenterVertical", "alignLeft", "alignRight", "alignTop", "alignTopLeft", "alignTopRight", "alert", "analyzeEvent", "annotation", "anomalyChart", "chartAnomaly", "anomalySwimLane", "apmApp", "apmTrace", "chartWaterfall", "appSearchApp", "apps", "arrowDown", "chevronSingleDown", "arrowLeft", "chevronSingleLeft", "arrowRight", "chevronSingleRight", "arrowUp", "chevronSingleUp", "arrowStart", "chevronLimitLeft", "arrowEnd", "chevronLimitRight", "article", "asterisk", "at", "archive", "axisX", "axisYLeft", "axisYRight", "auditbeatApp", "backgroundTask", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "briefcase", "branchUser", "broom", "brush", "bug", "bulb", "bullseye", "calendar", "canvasApp", "casesApp", "changePointDetection", "chartChangePoint", "chartArea", "chartAreaStack", "chartBarHorizontal", "chartBarHorizontalStack", "chartBarVertical", "chartBarVerticalStack", "chartGauge", "chartHeatmap", "chartLine", "chartPie", "chartTagCloud", "chartThreshold", "check", "checkCircle", "checkInCircleFilled", "checkCircleFill", "cheer", "popper", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "clockControl", "cloud", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "code", "codeApp", "color", "paintBucket", "commandLine", "comment", "compare", "compute", "processor", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "contrast", "contrastHigh", "contrastFill", "controls", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "crossProjectSearch", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInCircle", "crossCircle", "crosshair", "crosshairs", "currency", "money", "cut", "scissors", "dashboardApp", "dashedCircle", "dataVisualizer", "database", "desktop", "display", "devToolsApp", "diff", "discoverApp", "distributeHorizontal", "distributeVertical", "download", "drag", "dragHorizontal", "dragVertical", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "chevronDoubleLeft", "doubleArrowRight", "chevronDoubleRight", "ellipsis", "editorAlignCenter", "textAlignCenter", "editorAlignLeft", "textAlignLeft", "editorAlignRight", "textAlignRight", "editorBold", "textBold", "editorChecklist", "listCheck", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "textHeading", "editorItalic", "textItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "listNumber", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "redo", "editorStrike", "textStrike", "editorTable", "table", "editorUnderline", "textUnderline", "editorUndo", "undo", "editorUnorderedList", "listBullet", "email", "mail", "empty", "emsApp", "endpoint", "eql", "query", "eraser", "error", "errorFilled", "errorFill", "esqlVis", "exit", "logOut", "expand", "maximize", "expandMini", "export", "exportAction", "upload", "external", "eye", "eyeClosed", "eyeSlash", "faceHappy", "faceNeutral", "faceSad", "fieldStatistics", "tableInfo", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flask", "flag", "fleetApp", "fold", "folder", "folderClosed", "folderClose", "folderCheck", "folderExclamation", "folderOpen", "folderOpened", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "hourglass", "if", "info", "image", "importAction", "index", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "mapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "tableTime", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "queryField", "kqlFunction", "kqlOperand", "queryOperand", "kqlSelector", "querySelector", "kqlValue", "queryValue", "kubernetesNode", "kubernetesPod", "launch", "rocket", "layers", "lensApp", "lettering", "text", "lineBreak", "lineBreakSlash", "lineDash", "lineDashed", "lineDot", "lineDotted", "lineSolid", "link", "linkSlash", "list", "listAdd", "lock", "lockOpen", "logPatternAnalysis", "pattern", "logRateAnalysis", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVectorDB", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "queue", "machineLearningApp", "magnet", "magnify", "magnifyExclamation", "magnifyMinus", "magnifyPlus", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "map", "mapMarker", "waypoint", "megaphone", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusCircle", "minusInCircle", "minusInCircleFilled", "minusInSquare", "minusSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "newChat", "node", "vectorTriangle", "notebookApp", "number", "offline", "wifiSlash", "online", "wifi", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFill", "pinFilled", "pipeBreaks", "pipelineApp", "pipeNoBreaks", "pivot", "play", "playFilled", "plugs", "plus", "plusCircle", "plusInCircle", "plusInCircleFilled", "plusInSquare", "plusSquare", "popout", "presentation", "productRobot", "productAgent", "productCloudInfra", "productDashboard", "productDiscover", "productML", "productStreamsClassic", "productStreamsWired", "push", "send", "question", "quote", "radar", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "return", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "server", "sessionViewer", "shard", "share", "significantEvents", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "star", "starEmpty", "starEmptySpace", "starFill", "starFilled", "starFillSpace", "starFilledSpace", "starMinusEmpty", "starMinusFill", "starMinusFilled", "starPlusEmpty", "starPlusFill", "starPlusFilled", "stats", "stop", "stopFill", "stopFilled", "stopSlash", "storage", "streamsClassic", "streamsWired", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityHigh", "tableDensityExpanded", "tableDensityLow", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "thermometer", "thumbDown", "thumbUp", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "refreshTime", "timeslider", "training", "transitionBottomIn", "transitionBottomOut", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "unarchive", "vector", "vectorSquare", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "chartMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "warningFilled", "warningFill", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workflowsApp", "workflow", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDimension", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenSemanticText", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenDenseVector", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
isDisabled: PropTypes.bool
}),
helpText: PropTypes.node,
formatting: PropTypes.shape({
prefix: PropTypes.string,
suffix: PropTypes.string,
blockPrefix: PropTypes.string,
blockSuffix: PropTypes.string,
multiline: PropTypes.bool,
replaceNext: PropTypes.string,
prefixSpace: PropTypes.bool,
scanFor: PropTypes.string,
surroundWithNewlines: PropTypes.bool,
orderedList: PropTypes.bool,
trimFirst: PropTypes.bool
}),
editor: PropTypes.elementType
}).isRequired),
/** errors to bubble up */errors: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.any.isRequired, PropTypes.any.isRequired]).isRequired),
/** callback triggered when parsing results are available */onParse: PropTypes.func,
/** initial display mode for the editor */initialViewMode: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.any.isRequired]),
/** array defining any drag&drop handlers */dropHandlers: PropTypes.arrayOf(PropTypes.shape({
supportedFiles: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
accepts: PropTypes.func.isRequired,
getFormattingForItem: PropTypes.func.isRequired
}).isRequired),
/**
* Sets the placeholder of the textarea
*/
placeholder: PropTypes.any,
/**
* Further extend the props applied to EuiMarkdownFormat
*/
markdownFormatProps: PropTypes.shape({
className: PropTypes.string,
"aria-label": PropTypes.string,
"data-test-subj": PropTypes.string,
css: PropTypes.any,
/**
* Determines the text size. Choose `relative` to control the `font-size` based on the value of a parent container.
*/
textSize: PropTypes.any
}),
/**
* Props to customize the toolbar. `right` replaces the default preview/editor toggle with custom content.
*/
toolbarProps: PropTypes.shape({
className: PropTypes.string,
right: PropTypes.node
}),
/** Controls whether the footer is shown */showFooter: PropTypes.bool
};
EuiMarkdownEditor.displayName = 'EuiMarkdownEditor';