Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions znai-reactjs/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ const docMeta = {
previewEnabled: true,
slackChannel: "help-domain-name",
sendToSlackUrl: "http://localhost:5111/ask-in-slack",
slackActiveQuestionsUrl: "http://localhost:5111/active-questions",
sendToSlackIncludeContentType: true,
resolveSlackQuestionUrl: "http://localhost:5111/resolve-slack-question",
viewOn: {
link: "https://github.com/testingisdocumenting/znai/znai-cli/documentation",
title: "View On GitHub",
Expand Down
29 changes: 6 additions & 23 deletions znai-reactjs/src/diff/DiffTracking.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
enableDiffTracking,
enableDiffTrackingForOneDomChangeTransaction,
} from "./DiffTracking";
import { mainPanelClassName } from "../layout/classNames";
import { mainPanelClassName } from "../layout/classNamesAndIds";

const [getTextValue, setTextValue] = simulateState("hello");
const [getSvgTextValue, setSvgTextValue] = simulateState("svg hello");
Expand All @@ -37,22 +37,14 @@ const [getScrollCaseBeforeItems, setScrollCaseBeforeItems] = simulateState([
"line4",
"line5",
]);
const [getScrollCaseAfterItems, setScrollCaseAfterItems] = simulateState([
"line1",
"line2",
"line3",
"line4",
"line5",
]);
const [getScrollCaseAfterItems, setScrollCaseAfterItems] = simulateState(["line1", "line2", "line3", "line4", "line5"]);

export function diffTrackingDemo(registry: Registry) {
registry.add("tracking control", () => (
<div>
<button onClick={enableDiffTracking}>enable</button>
<button onClick={disableDiffTracking}>disable</button>
<button onClick={enableDiffTrackingForOneDomChangeTransaction}>
enable for one change transaction
</button>
<button onClick={enableDiffTrackingForOneDomChangeTransaction}>enable for one change transaction</button>
</div>
));

Expand Down Expand Up @@ -95,10 +87,7 @@ export function diffTrackingDemo(registry: Registry) {

registry.add("with scroll", () => (
<DiffTracking>
<div
className={mainPanelClassName}
style={{ maxHeight: 100, overflow: "auto" }}
>
<div className={mainPanelClassName} style={{ maxHeight: 100, overflow: "auto" }}>
<div className="page-content">
{getScrollCaseBeforeItems().map((item, idx) => (
<div key={idx} className="znai-simple-text">
Expand Down Expand Up @@ -143,16 +132,10 @@ function addAfterItem() {

function addScrollCaseBeforeItem() {
itemIdx++;
setScrollCaseBeforeItems([
...getScrollCaseBeforeItems(),
"another item " + itemIdx,
]);
setScrollCaseBeforeItems([...getScrollCaseBeforeItems(), "another item " + itemIdx]);
}

function addScrollCaseAfterItem() {
itemIdx++;
setScrollCaseAfterItems([
...getScrollCaseAfterItems(),
"another item " + itemIdx,
]);
setScrollCaseAfterItems([...getScrollCaseAfterItems(), "another item " + itemIdx]);
}
8 changes: 2 additions & 6 deletions znai-reactjs/src/diff/DiffTracking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as React from "react";
import { HtmlNodeDiff } from "./HtmlNodeDiff";

import "./DiffTracking.css";
import { mainPanelClassName } from "../layout/classNames";
import { mainPanelClassName } from "../layout/classNamesAndIds";

let enabled = false;
let autoDisable = false;
Expand Down Expand Up @@ -62,11 +62,7 @@ export class DiffTracking extends React.Component<Props, {}> {
};
}

componentDidUpdate(
prevProps: Props,
prevState: {},
snapshot: { beforeNode: HTMLElement }
) {
componentDidUpdate(prevProps: Props, prevState: {}, snapshot: { beforeNode: HTMLElement }) {
if (!snapshot) {
return;
}
Expand Down
Loading