feat: Paste Components (OLX) into any Unit in Studio (#31969)
* feat: Implement paste button * chore: improve docs and add tests for python API * fix: drive-by fix to use a better API for comparing XML * feat: track which XBlock something was copied from * feat: add tests * feat: enable import linter so content_staging's public API is respected * fix: error seen when trying to paste drag-and-drop-v2 blocks * fix: use strip_text=True consistently for XML comparisons * refactor: rename get_user_clipboard_status to get_user_clipboard * feat: Better error reporting when pasting in Studio * chore: convert new test suite to pytest assertions * refactor: push READY status check into the API per review suggestion * fix: use strip_text=True consistently for XML comparisons * fix: store "copied_from_block" as a string to avoid Reference field issues * fix: minor lint error * refactor: move data types to data.py per OEP-49
This commit is contained in:
@@ -8,6 +8,7 @@ import logging
|
||||
from django.conf import settings
|
||||
from web_fragments.fragment import Fragment
|
||||
from xblock.core import XBlock, XBlockMixin
|
||||
from xblock.fields import String, Scope
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,3 +44,10 @@ class AuthoringMixin(XBlockMixin):
|
||||
fragment.add_javascript_url(self._get_studio_resource_url('/js/xblock/authoring.js'))
|
||||
fragment.initialize_js('VisibilityEditorInit')
|
||||
return fragment
|
||||
|
||||
copied_from_block = String(
|
||||
# Note: used by the content_staging app. This field is not needed in the LMS.
|
||||
help="ID of the block that this one was copied from, if any. Used when copying and pasting blocks in Studio.",
|
||||
scope=Scope.settings,
|
||||
enforce_type=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user