mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Merge branch 'master' of https://git.scc.kit.edu/pse-typinferenz/typicalc
This commit is contained in:
commit
7a28facd83
12
frontend/src/share-dialog-autoselect.js
Normal file
12
frontend/src/share-dialog-autoselect.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
window.autoSelect = (className) => {
|
||||||
|
let el = document.getElementsByClassName(className);
|
||||||
|
Array.from(el).forEach(field => {
|
||||||
|
field.addEventListener('focus', event => {
|
||||||
|
let e = event.target.shadowRoot.querySelector('input');
|
||||||
|
if (!e) {
|
||||||
|
e = event.target.shadowRoot.querySelector('textArea');
|
||||||
|
}
|
||||||
|
e.setSelectionRange(0, e.value.length);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -22,16 +22,16 @@ function listener(area) {
|
|||||||
var value = parseBack(area.value);
|
var value = parseBack(area.value);
|
||||||
var start = area.selectionStart;
|
var start = area.selectionStart;
|
||||||
var end = area.selectionEnd;
|
var end = area.selectionEnd;
|
||||||
if (value.startsWith('t') && isNumeric(value.substr(1, value.length - 1))) {
|
// ignore brackets, allow '>' or spaces in front and '-' or spaces at the end of string
|
||||||
area.value = value.replace('t', '\u03C4');
|
area.value = value.replace(/(^|\s+|\(|\)|>)t[0-9]+(?=\s+|\)|\(|\-|$)/ig, replacer);
|
||||||
area.value = area.value.replace(/[0123456789]/g, toUnicode);
|
|
||||||
} else {
|
|
||||||
area.value = value;
|
|
||||||
}
|
|
||||||
area.selectionStart = start;
|
area.selectionStart = start;
|
||||||
area.selectionEnd = end;
|
area.selectionEnd = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replacer(value) {
|
||||||
|
value = value.replace('t', '\u03C4');
|
||||||
|
return value.replace(/[0123456789]/g, toUnicode);
|
||||||
|
}
|
||||||
|
|
||||||
function toUnicode(number) {
|
function toUnicode(number) {
|
||||||
return subscripted[number];
|
return subscripted[number];
|
||||||
@ -44,10 +44,6 @@ function toNumber(unicode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseBack(value) {
|
function parseBack(value) {
|
||||||
value = value.replace('\u03C4', 't');
|
value = value.replaceAll('\u03C4', 't');
|
||||||
return value.replace(/./g, toNumber);
|
return value.replace(/./g, toNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNumeric(value) {
|
|
||||||
return /^\d+$/.test(value);
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#startPage-Heading {
|
#startPage-Heading {
|
||||||
margin-top: 50px;
|
margin-top: 20px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
}
|
}
|
||||||
@ -26,11 +26,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#controlPanel {
|
|
||||||
margin-top: auto;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#startPage {
|
#startPage {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -42,6 +42,8 @@ public class ControlPanel extends HorizontalLayout implements LocaleChangeObserv
|
|||||||
previousStep = new Button(new Icon(VaadinIcon.ANGLE_LEFT), evt -> view.previousStepButton());
|
previousStep = new Button(new Icon(VaadinIcon.ANGLE_LEFT), evt -> view.previousStepButton());
|
||||||
previousStep.setId(PREVIOUS_STEP_ID);
|
previousStep.setId(PREVIOUS_STEP_ID);
|
||||||
share = new Button(new Icon(VaadinIcon.CONNECT), evt -> view.shareButton());
|
share = new Button(new Icon(VaadinIcon.CONNECT), evt -> view.shareButton());
|
||||||
|
share.getStyle().set("margin-left", "auto");
|
||||||
|
lastStep.getStyle().set("margin-right", "auto");
|
||||||
|
|
||||||
add(share, firstStep, previousStep, nextStep, lastStep);
|
add(share, firstStep, previousStep, nextStep, lastStep);
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,7 @@ import com.flowingcode.vaadin.addons.carousel.Slide;
|
|||||||
import com.vaadin.flow.component.Text;
|
import com.vaadin.flow.component.Text;
|
||||||
import com.vaadin.flow.component.dependency.CssImport;
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
import com.vaadin.flow.component.dependency.JsModule;
|
import com.vaadin.flow.component.dependency.JsModule;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.*;
|
||||||
import com.vaadin.flow.component.html.Div;
|
|
||||||
import com.vaadin.flow.component.html.H1;
|
|
||||||
import com.vaadin.flow.component.html.Hr;
|
|
||||||
import com.vaadin.flow.component.html.Paragraph;
|
|
||||||
import com.vaadin.flow.component.html.Span;
|
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.progressbar.ProgressBar;
|
import com.vaadin.flow.component.progressbar.ProgressBar;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
@ -53,6 +48,7 @@ public class StartPageView extends VerticalLayout implements ControlPanelView, L
|
|||||||
* Fills the view with content.
|
* Fills the view with content.
|
||||||
*/
|
*/
|
||||||
public StartPageView() {
|
public StartPageView() {
|
||||||
|
VerticalLayout content = new VerticalLayout();
|
||||||
ControlPanel controlPanel = new ControlPanel(this);
|
ControlPanel controlPanel = new ControlPanel(this);
|
||||||
controlPanel.setId(CONTROL_PANEL_ID);
|
controlPanel.setId(CONTROL_PANEL_ID);
|
||||||
controlPanel.setEnabledShareButton(false);
|
controlPanel.setEnabledShareButton(false);
|
||||||
@ -81,8 +77,17 @@ public class StartPageView extends VerticalLayout implements ControlPanelView, L
|
|||||||
slideProgress = new ProgressBar(slideShow.getStartPosition(), slideShow.getSlides().length - 1);
|
slideProgress = new ProgressBar(slideShow.getStartPosition(), slideShow.getSlides().length - 1);
|
||||||
slideProgress.setId(SLIDE_PROGRESS_ID);
|
slideProgress.setId(SLIDE_PROGRESS_ID);
|
||||||
|
|
||||||
add(heading, line1, textContainer, slideProgress, slideShow, line2, controlPanel);
|
content.setAlignItems(Alignment.CENTER);
|
||||||
|
content.add(heading, line1, textContainer, slideProgress, slideShow, line2);
|
||||||
setId(START_PAGE_ID);
|
setId(START_PAGE_ID);
|
||||||
|
|
||||||
|
Footer footer = new Footer(controlPanel);
|
||||||
|
footer.setWidthFull();
|
||||||
|
footer.getStyle().set("position", "sticky");
|
||||||
|
footer.getStyle().set("bottom", "1em");
|
||||||
|
footer.getStyle().set("background-color", "white");
|
||||||
|
content.setWidthFull();
|
||||||
|
add(content, footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Carousel createScenarioCarousel() {
|
private Carousel createScenarioCarousel() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package edu.kit.typicalc.view.content.typeinferencecontent;
|
package edu.kit.typicalc.view.content.typeinferencecontent;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.UI;
|
||||||
import com.vaadin.flow.component.dependency.CssImport;
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
|
import com.vaadin.flow.component.dependency.JsModule;
|
||||||
import com.vaadin.flow.component.dialog.Dialog;
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
import com.vaadin.flow.component.html.H3;
|
import com.vaadin.flow.component.html.H3;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
@ -15,6 +17,7 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
|
|||||||
/**
|
/**
|
||||||
* Contains GUI elements to extract the URL and LaTeX code of the currently shown proof tree.
|
* Contains GUI elements to extract the URL and LaTeX code of the currently shown proof tree.
|
||||||
*/
|
*/
|
||||||
|
@JsModule("./src/share-dialog-autoselect.js")
|
||||||
@CssImport("./styles/view/share-dialog.css")
|
@CssImport("./styles/view/share-dialog.css")
|
||||||
public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
||||||
|
|
||||||
@ -62,6 +65,7 @@ public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
|||||||
packageArea.setClassName(FIELD_CLASS);
|
packageArea.setClassName(FIELD_CLASS);
|
||||||
latexArea.setValue(latexCode);
|
latexArea.setValue(latexCode);
|
||||||
latexArea.setClassName(FIELD_CLASS);
|
latexArea.setClassName(FIELD_CLASS);
|
||||||
|
UI.getCurrent().getPage().executeJs("window.autoSelect($0)", FIELD_CLASS);
|
||||||
|
|
||||||
layout.add(urlField, packageArea, latexArea);
|
layout.add(urlField, packageArea, latexArea);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import com.vaadin.flow.component.UI;
|
|||||||
import com.vaadin.flow.component.dependency.CssImport;
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
import com.vaadin.flow.component.dependency.JavaScript;
|
import com.vaadin.flow.component.dependency.JavaScript;
|
||||||
import com.vaadin.flow.component.html.Div;
|
import com.vaadin.flow.component.html.Div;
|
||||||
import com.vaadin.flow.component.orderedlayout.Scroller;
|
import com.vaadin.flow.component.html.Footer;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||||
@ -33,7 +33,6 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
* Route of this view.
|
* Route of this view.
|
||||||
*/
|
*/
|
||||||
public static final String ROUTE = "infer";
|
public static final String ROUTE = "infer";
|
||||||
private static final String SCROLLER_ID = "scroller";
|
|
||||||
private static final String CONTENT_ID = "content";
|
private static final String CONTENT_ID = "content";
|
||||||
private static final String ID = "type-inference-view";
|
private static final String ID = "type-inference-view";
|
||||||
|
|
||||||
@ -64,14 +63,17 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
content = new Div();
|
content = new Div();
|
||||||
content.setId(CONTENT_ID);
|
content.setId(CONTENT_ID);
|
||||||
controlPanel = new ControlPanel(this);
|
controlPanel = new ControlPanel(this);
|
||||||
Scroller scroller = new Scroller(content);
|
|
||||||
scroller.setId(SCROLLER_ID);
|
|
||||||
scroller.setScrollDirection(Scroller.ScrollDirection.BOTH);
|
|
||||||
add(scroller, controlPanel);
|
|
||||||
treeNumbers = lc.getTreeNumbers();
|
treeNumbers = lc.getTreeNumbers();
|
||||||
setContent();
|
setContent();
|
||||||
controlPanel.setEnabledFirstStep(false);
|
controlPanel.setEnabledFirstStep(false);
|
||||||
controlPanel.setEnabledPreviousStep(false);
|
controlPanel.setEnabledPreviousStep(false);
|
||||||
|
|
||||||
|
Footer footer = new Footer(controlPanel);
|
||||||
|
footer.getStyle().set("position", "sticky");
|
||||||
|
footer.getStyle().set("bottom", "1em");
|
||||||
|
content.getStyle().set("overflow", "auto");
|
||||||
|
content.setWidthFull();
|
||||||
|
add(content, footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setContent() {
|
private void setContent() {
|
||||||
|
Loading…
Reference in New Issue
Block a user