Skip to content

Commit bbf5df0

Browse files
Merge branch 'main' into 1015-data-cy-menu
2 parents cee2623 + 5c2e51a commit bbf5df0

File tree

8 files changed

+52
-6
lines changed

8 files changed

+52
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bigbinary/neeto-editor",
3-
"version": "1.29.8",
3+
"version": "1.29.9",
44
"main": "./index.cjs.js",
55
"module": "./index.js",
66
"types": "./types.d.ts",

src/components/Editor/CustomExtensions/CodeBlock/CodeBlockComponent.jsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useEffect, useState } from "react";
22

33
import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
4+
import classNames from "classnames";
45
import { Down } from "neetoicons";
56
import CopyToClipboardButton from "neetomolecules/CopyToClipboardButton";
67
import { Dropdown, Input } from "neetoui";
@@ -13,6 +14,7 @@ const { Menu, MenuItem } = Dropdown;
1314

1415
const CodeBlockComponent = ({ node, editor, updateAttributes }) => {
1516
const [keyword, setKeyword] = useState("");
17+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
1618

1719
const { t } = useTranslation();
1820

@@ -35,14 +37,21 @@ const CodeBlockComponent = ({ node, editor, updateAttributes }) => {
3537
return (
3638
<NodeViewWrapper data-cy="neeto-editor-code-block">
3739
<pre>
38-
<div className="neeto-editor-codeblock-options">
40+
<div
41+
className={classNames("neeto-editor-codeblock-options", {
42+
"neeto-editor-codeblock-options--open": isDropdownOpen,
43+
})}
44+
>
3945
<Dropdown
4046
appendTo={() => document.body}
4147
buttonSize="small"
4248
buttonStyle="secondary"
4349
icon={Down}
50+
isOpen={isDropdownOpen}
4451
label={node.attrs?.language || t("neetoEditor.common.auto")}
4552
strategy="fixed"
53+
onClick={() => setIsDropdownOpen(isOpen => !isOpen)}
54+
onClose={() => setIsDropdownOpen(false)}
4655
>
4756
<Input
4857
autoFocus
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import { lowlight } from "lowlight";
22

3-
export const SORTED_LANGUAGE_LIST = lowlight.listLanguages().sort();
3+
export const SORTED_LANGUAGE_LIST = [
4+
...lowlight.listLanguages(),
5+
"html",
6+
].sort();

src/components/Editor/MediaUploader/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ const MediaUploader = ({ mediaUploader, onClose, editor, unsplashApiKey }) => {
5050
.run();
5151
};
5252

53+
const handleKeydown = event =>
54+
not(isUploading) && event.key === "Escape" && handleClose();
55+
5356
return (
5457
<Modal
5558
closeButton={false}
5659
{...{ isOpen }}
57-
closeOnEsc={not(isUploading)}
5860
closeOnOutsideClick={not(isUploading)}
5961
onClose={handleClose}
62+
onKeyDown={handleKeydown}
6063
>
6164
<div className="ne-media-uploader">
6265
{!isNotPresent(tabs) && (

src/components/EditorContent/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export const CODE_BLOCK_REGEX =
1313
export const VARIABLE_SPAN_REGEX =
1414
/<span data-variable="" [^>]*data-label="([^"]+)">{{([^}]+)}}<\/span>/g;
1515

16-
export const LANGUAGE_LIST = lowlight.listLanguages();
16+
export const LANGUAGE_LIST = [...lowlight.listLanguages(), "html"];

src/styles/editor/_editor-content.scss

+6
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@
154154
&__input {
155155
margin: 4px 4px;
156156
}
157+
158+
&--open {
159+
display: flex;
160+
opacity: 1;
161+
transform: scale(1);
162+
}
157163
}
158164

159165
&:hover {

src/translations/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
},
9595
"localUploader": {
9696
"dropFilesHere": "Drop your file(s) here or Browse.",
97-
"maxFileSize": "Max. File Size: {{entity}}",
97+
"maxFileSize": "Max. File Size: {{entity, anyCase}}",
9898
"completed": "Completed"
9999
}
100100
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Meta } from "@storybook/addon-docs";
2+
3+
<Meta
4+
title="Walkthroughs/Text formatting"
5+
parameters={{
6+
layout: "padded",
7+
viewMode: "docs",
8+
previewTabs: {
9+
canvas: {
10+
hidden: true,
11+
},
12+
},
13+
}}
14+
/>
15+
16+
# Formatting text in rich text editor
17+
18+
<br />
19+
20+
neetoEditor offers a diverse range of features beyond basic text formatting. In addition to various formatting options
21+
such as bold, italic, inline code, and strikethrough text, you can seamlessly integrate links and embedded content,
22+
as well as include images, videos, and other attachments, providing a comprehensive set of tools for various types of
23+
content and formatting.
24+
25+
[Learn more about formatting text](https://help.neetocal.com/articles/formatting-text-in-rich-text-editors).

0 commit comments

Comments
 (0)