Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Setting up view program page editor #4801

Merged
merged 4 commits into from
Nov 28, 2023
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: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,8 @@ def view_program(user, id):
javascript_page_options=dict(
page='view-program',
lang=g.lang,
level=int(result['level'])),
level=int(result['level']),
code=code),
**arguments_dict)


Expand Down
6 changes: 6 additions & 0 deletions static/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export interface InitializeViewProgramPageOptions {
readonly page: 'view-program';
readonly level: number;
readonly lang: string;
readonly code: string;
}

export function initializeViewProgramPage(options: InitializeViewProgramPageOptions) {
Expand All @@ -344,7 +345,12 @@ export function initializeViewProgramPage(options: InitializeViewProgramPageOpti
// We need to enable the main editor for the program page as well
const dir = $("body").attr("dir");
theGlobalEditor = editorCreator.initializeEditorWithGutter($('#editor'), EditorType.MAIN, dir);
initializeTranslation({
keywordLanguage: options.lang,
level: options.level
});
attachMainEditorEvents(theGlobalEditor);
theGlobalEditor.contents = options.code;
error.setEditor(theGlobalEditor);
initializeDebugger({
editor: theGlobalEditor,
Expand Down
80 changes: 40 additions & 40 deletions static/js/appbundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/js/appbundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/incl/editor-and-output.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<button id="debug_button" class="green-btn" onclick='hedyApp.runit({{ level }}, "{{ g.lang }}", {{_('already_program_running')|default(None)|tojson}}, "debug")'>🐞</button>
<button id="debug_restart" class="green-btn hidden" onclick='hedyApp.runit({{ level }}, "{{ g.lang }}", {{_('already_program_running')|default(None)|tojson}}, "debug")'>🔄</button>
<button id="debug_stop" class="green-btn hidden" onclick="hedyApp.stopDebug()">🛑</button>
<button id="debug_continue" class="green-btn" onclick='hedyApp.runit({{ level }}, "{{ g.lang }}", {{_('already_program_running')|default(None)|tojson}}, "continue")'><div class="{% if g.dir == "rtl" %}rotate-180{% endif %}">⏩</div></button>
<button id="debug_continue" class="green-btn hidden" onclick='hedyApp.runit({{ level }}, "{{ g.lang }}", {{_('already_program_running')|default(None)|tojson}}, "continue")'><div class="{% if g.dir == "rtl" %}rotate-180{% endif %}">⏩</div></button>
</div>
<button id="next_parson_button" max_exercise="{{ parsons_exercises }}" class="green-btn ltr:ml-auto rtl:mr-auto" style="display: none;">{{_('next_exercise')}}</button>
{% if show_edit_button %}
Expand Down
Loading