Use webpack to deliver newest ACE editor

With this commit, we change the delivery method for the ACE editor from manually copied files to using yarn and webpack. As a side-change, we also modify how the mode is selected through JavaScript instead of Ruby.

Through webpack, the `modePath`, `themePath`, and `workerPath` are automatically determined and working as expected.

Closes #250
This commit is contained in:
Sebastian Serth
2024-02-14 00:47:50 +01:00
committed by Sebastian Serth
parent 942dbd20db
commit 4f8d313da4
480 changed files with 39 additions and 329597 deletions

View File

@ -3,7 +3,6 @@
class FileTypesController < ApplicationController
include CommonBehavior
before_action :set_editor_modes, only: %i[create edit new update]
before_action :set_file_type, only: MEMBER_ACTIONS
def authorize!
@ -38,14 +37,6 @@ class FileTypesController < ApplicationController
create_and_respond(object: @file_type)
end
def set_editor_modes
@editor_modes = Dir.glob('vendor/assets/javascripts/ace/mode-*.js').map do |filename|
name = filename.gsub(%r{\w+/|mode-|.js$}, '')
[name, "ace/mode/#{name}"]
end
end
private :set_editor_modes
def set_file_type
@file_type = FileType.find(params[:id])
authorize!