@@ -159,6 +159,13 @@ class HtmlBlock(LegacyXmlMixin, XBlock): # pylint: disable=abstract-method
159159 default = _ ("Text" ),
160160 )
161161 data = String (help = _ ("Html contents to display for this block" ), default = "" , scope = Scope .content )
162+ upstream_data = String (
163+ help = _ ("Upstream html contents to store upstream data field" ),
164+ default = None ,
165+ hidden = True ,
166+ enforce_type = True ,
167+ scope = Scope .content ,
168+ )
162169 source_code = String (
163170 help = _ ("Source code for LaTeX documents. This feature is not well-supported." ), scope = Scope .settings
164171 )
@@ -179,6 +186,7 @@ class HtmlBlock(LegacyXmlMixin, XBlock): # pylint: disable=abstract-method
179186 uses_xmodule_styles_setup = True
180187 template_dir_name = "html"
181188 show_in_read_only_mode = True
189+ icon_class = "other"
182190
183191 @property
184192 def category (self ):
@@ -252,17 +260,26 @@ def get_html(self):
252260 user_id = current_user .opt_attrs .get (ATTR_KEY_DEPRECATED_ANONYMOUS_USER_ID )
253261 if user_id :
254262 data = data .replace ("%%USER_ID%%" , user_id )
263+ if current_user .emails :
264+ email = current_user .emails [0 ]
265+ data = data .replace ("%%USER_EMAIL%%" , email )
255266
256267 # The course ID replacement is always safe to run.
257268 data = data .replace ("%%COURSE_ID%%" , str (self .scope_ids .usage_id .context_key ))
258269 return data
259270
260271 def studio_view (self , context = None ): # pylint: disable=unused-argument
261272 """Return a fragment that contains the html for the studio view."""
262- frag = Fragment (self .get_html ())
263- frag .add_javascript ("""function HtmlBlock(runtime, element){}""" )
264- frag .initialize_js ("HtmlBlock" )
265- return frag
273+ # Only the ReactJS editor is supported for this block.
274+ # See https://github.com/openedx/frontend-app-authoring/tree/master/src/editors/containers/TextEditor
275+ raise NotImplementedError
276+
277+ @classmethod
278+ def get_customizable_fields (cls ) -> dict [str , str | None ]:
279+ return {
280+ "display_name" : "upstream_display_name" ,
281+ "data" : "upstream_data" ,
282+ }
266283
267284 # VS[compat] TODO (cpennington): Delete this method once all fall 2012 course
268285 # are being edited in the cms
0 commit comments