Skip to content

Commit

Permalink
Polish and adress review
Browse files Browse the repository at this point in the history
  • Loading branch information
OEvgeny committed Dec 5, 2024
1 parent a0ab92d commit 6dff1d2
Show file tree
Hide file tree
Showing 69 changed files with 18 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/html2/activity/viewCodeButton.html.snap-2.png
Binary file modified __tests__/html2/markdown/codeBlock/layout.html.snap-1.png
Binary file modified __tests__/html2/markdown/codeBlockCopyButton/layout.html.snap-1.png
Binary file modified __tests__/html2/markdown/math/layout.spec.html.snap-1.png
Binary file modified __tests__/html2/markdown/math/layout.spec.html.snap-2.png
Binary file modified __tests__/html2/markdown/math/layout.spec.html.snap-3.png
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"prop-types": "15.8.1",
"punycode": "2.3.1",
"sanitize-html": "2.13.0",
"shiki": "^1.22.2",
"shiki": "1.22.2",
"swiper": "8.4.7",
"url-search-params-polyfill": "8.2.5",
"uuid": "8.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/bundle/src/markdown/renderMarkdown.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
HighlightCodeFn,
parseDocumentFragmentFromString,
serializeDocumentFragmentIntoString
serializeDocumentFragmentIntoString,
type HighlightCodeFn
} from 'botframework-webchat-component/internal';
import { onErrorResumeNext } from 'botframework-webchat-core';
import katex from 'katex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ViewCodeButton = ({ className, code, language, title = '', isAIGenerated =
'aria-label': localize('ACTIVITY_CODE_ALT', title ?? '')
}
);
}, [showModal, viewCodeDialog, localize, title, code, language, isAIGenerated]);
}, [code, isAIGenerated, language, localize, showModal, title, viewCodeDialog]);

return (
<ActivityButton
Expand Down
9 changes: 5 additions & 4 deletions packages/component/src/Styles/StyleSet/CodeBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function createCodeBlockStyle() {
display: 'block',
margin: '16px 0',
overflow: 'hidden',
padding: '4px',
padding: '4px 4px 4px 8px',

':has(> .github-dark-default)': {
background: `var(${CustomPropertyNames.BackgroundCodeBlock}, #0d1117)`,
Expand All @@ -28,10 +28,11 @@ export default function createCodeBlockStyle() {
},

'.webchat__code-block__body': {
margin: '0 0 0 4px',
whiteSpace: 'pre-wrap',
display: 'contents',
lineHeight: 'normal',
outline: 'none'
margin: '0',
outline: 'none',
whiteSpace: 'pre-wrap'
}
}
};
Expand Down
1 change: 1 addition & 0 deletions packages/component/src/Styles/StyleSet/ViewCodeDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default function createViewCodeDialogStyle() {
height: '100%',

'.webchat__code-block__body': {
display: 'block',
margin: 0,
padding: '16px 0'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class CodeBlock extends HTMLElement {
static observedAttributes = Object.freeze(['theme', 'language']);

connected = false;
copyButtonElement = null;
highlightedCodeFragment: DocumentFragment = null;
copyButtonElement = undefined;
highlightedCodeFragment: DocumentFragment = undefined;

#originalFragment: DocumentFragment = null;
#originalFragment: DocumentFragment = undefined;

get code() {
return this.querySelector('code')?.textContent ?? '';
Expand All @@ -38,7 +38,7 @@ class CodeBlock extends HTMLElement {
}

attributeChangedCallback() {
this.highlightedCodeFragment = null;
this.highlightedCodeFragment = undefined;
this.update();
}

Expand Down Expand Up @@ -135,20 +135,20 @@ const createReactCodeBlockClass = ({
this.#controller = new AbortController();

trackCodeBlockRefChanges(() => {
this.highlightedCodeFragment = null;
this.highlightedCodeFragment = undefined;
this.update();
}, this.#controller.signal);

trackCopyButtonRefChanges(() => {
this.copyButtonElement = null;
this.copyButtonElement = undefined;
this.update();
}, this.#controller.signal);
}
}

disconnectedCallback() {
this.#controller?.abort();
this.#controller = null;
this.#controller = undefined;
}

highlight(...args: Parameters<HighlightCodeFn>) {
Expand Down

0 comments on commit 6dff1d2

Please sign in to comment.