Skip to content

Instantly share code, notes, and snippets.

View ljmotta's full-sized avatar

Luiz João Motta ljmotta

  • Senior Software Engineer - IBM
  • São Paulo, SP - Brazil
View GitHub Profile
@ljmotta
ljmotta / PingPongViewsPage.tsx
Created October 14, 2020 20:58
PingPongViewsPage
import { PingPongChannelApi } from "ping-pong-view/dist/api";
let pings = 0;
let pongs = 0;
export function PingPongViewsPage() {
const [lastPing, setLastPing] = useState<string>("-");
const [lastPong, setLastPong] = useState<string>("-");
const api: PingPongChannelApi = useMemo(() => {
@ljmotta
ljmotta / TodoListViewPage.tsx
Created October 14, 2020 20:57
TodoListViewPage
export function TodoListViewPage() {
const todoListViewRef = useRef<TodoListApi>(null);
return (
<Page>
<div className={"webapp--page-main-div"}>
<ActionsSidebar todoListViewRef={todoListViewRef} />
<PageSection>
<EmbeddedTodoList
ref={todoListViewRef}
@ljmotta
ljmotta / BpmnPage.tsx
Last active October 14, 2020 21:05
BpmnPage Envelope Locator
const editorEnvelopeLocator: EditorEnvelopeLocator = useMemo(() => {
return {
targetOrigin: window.location.origin,
mapping: new Map([
[
"bpmn",
{
resourcesPathPrefix: "https://kiegroup.github.io/kogito-online/editors/0.7.0/bpmn",
envelopePath: "https://kiegroup.github.io/kogito-online/editors/0.7.0/envelope",
},
@ljmotta
ljmotta / DmnPage.tsx
Created October 14, 2020 20:54
DmnPage Render
import { EmbeddedEditor, useEditorRef } from "@kogito-tooling/editor/dist/embedded";
export function DmnPage() {
//
const { editor, ref } = useEditorRef();
return (
<Page>
<div className={"webapp--page-main-div"}>
@ljmotta
ljmotta / DmnPage.tsx
Created October 14, 2020 20:52
DmnPage Editor Envelope Locator
import { EditorEnvelopeLocator } from "@kogito-tooling/editor/dist/api";
export function DmnPage() {
// ...
const editorEnvelopeLocator: EditorEnvelopeLocator = useMemo(() => {
return {
targetOrigin: window.location.origin,
mapping: new Map([
[
@ljmotta
ljmotta / DmnPage.tsx
Created October 14, 2020 20:49
DmnPage File State
import { File } from "@kogito-tooling/editor/dist/embedded";
export function DmnPage() {
const [file, setFile] = useState<File>({
fileName: "new-file",
fileExtension: "dmn",
getFileContents: () => Promise.resolve(""),
isReadOnly: false,
});
@ljmotta
ljmotta / Base64PngPage.tsx
Created October 14, 2020 20:42
Base64PngPage
import { EditorEnvelopeLocator } from "@kogito-tooling/editor/dist/embedded";
export function Base64PngPage() {
// ...
return (
<Page>
<div className={"webapp--page-main-div"}>
<Base64PngGallery setFile={setFile} />
<EmbeddedEditor
@ljmotta
ljmotta / Base64PngPage.tsx
Created October 14, 2020 20:41
Base64PngPage Envelope Locator
import { EditorEnvelopeLocator } from "@kogito-tooling/editor/dist/api";
export function Base64PngPage() {
// ...
const editorEnvelopeLocator: EditorEnvelopeLocator = useMemo(() => {
return {
targetOrigin: window.location.origin,
mapping: new Map([
[
@ljmotta
ljmotta / Base64PngPage.tsx
Created October 14, 2020 20:40
Base64PngPage
import { File } from "@kogito-tooling/editor/dist/embedded";
export function Base64PngPage() {
const [file, setFile] = useState<File>({
fileName: "new-file",
fileExtension: "base64png",
getFileContents: () => Promise.resolve(""),
isReadOnly: false,
});
@ljmotta
ljmotta / PingPongReactImplFactory.ts
Last active October 14, 2020 20:33
PingPong Envelope Init
import { EnvelopeBusMessage } from "@kogito-tooling/envelope-bus/dist/api";
import { init } from "ping-pong-view/dist/envelope";
import { PingPongReactImplFactory } from "ping-pong-view-react";
init({
container: document.getElementById("envelope-app")!,
bus: {
postMessage<D, Type>(message: EnvelopeBusMessage<D, Type>, targetOrigin?: string, transfer?: any) {
window.parent.postMessage(message, "*", transfer);
},