EditorKit (@NotNull Editor editor, boolean useTipsKit) { HTMLEditorKit editorKit = new HTMLEditorKitBuilder() .withViewFactoryExtensions(useTipsKit ? new ShortcutExtension() : ((element, view) -> view instanceof ImageView ? new MyScalingImageView(element) : null) ) .withFontResolver(EditorCssFontResolver.getInstance(editor)) .build(); editorKit.getStyleSheet().addStyleSheet(getStyleSheet(editor, useTipsKit)); return editorKit; }