Skip to content

Commit

Permalink
Fix #24361 block editor code block should not show suggestions or pla…
Browse files Browse the repository at this point in the history
…ceholder (#24403)

* #24361 Blocking suggestions and placeholder

* #24361 Blocking suggestions and placeholder

* #24361 Blocking suggestions and placeholder

* #24361 Blocking suggestions and placeholder

* build file

---------

Co-authored-by: Freddy Montes <751424+fmontes@users.noreply.github.com>
  • Loading branch information
manuelrojas and fmontes committed Mar 20, 2023
1 parent fb6e085 commit a1727c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Expand Up @@ -46,7 +46,8 @@ import {
BubbleAssetFormExtension,
ImageUpload,
FreezeScroll,
FREEZE_SCROLL_KEY
FREEZE_SCROLL_KEY,
NodeTypes
} from '../../extensions';
import { ContentletBlock, ImageNode, VideoNode } from '../../nodes';
import {
Expand Down Expand Up @@ -397,10 +398,14 @@ export class DotBlockEditorComponent implements OnInit, OnDestroy {
* @memberof DotBlockEditorComponent
*/
private placeholder({ node }) {
if (node.type.name === 'heading') {
if (node.type.name === NodeTypes.HEADING) {
return `${toTitleCase(node.type.name)} ${node.attrs.level}`;
}

if (node.type.name === NodeTypes.CODE_BLOCK) {
return;
}

return 'Type "/" for commmands';
}

Expand Down
Expand Up @@ -238,7 +238,11 @@ export const ActionsMenu = (
findParentNode(editor.view.state.selection.$from, [NodeTypes.TABLE_CELL])?.type.name ===
NodeTypes.TABLE_CELL;

shouldShow = !isTableCell;
const isCodeBlock =
findParentNode(editor.view.state.selection.$from, [NodeTypes.CODE_BLOCK])?.type.name ===
NodeTypes.CODE_BLOCK;

shouldShow = !isTableCell && !isCodeBlock;
}

function setUpSuggestionComponent(editor: Editor, range: Range) {
Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/webapp/html/dotcms-block-editor.js

Large diffs are not rendered by default.

0 comments on commit a1727c2

Please sign in to comment.