Introduce new callback: callback.document.did-open

Bundle items using this as their semantic class will be executed when the document is first loaded.
This commit is contained in:
Allan Odgaard
2016-05-30 12:00:44 +02:00
parent c649aed750
commit 57d64d515a

View File

@@ -1042,6 +1042,12 @@ namespace
// = Document I/O =
// ================
- (void)didOpenDocuemntInTextView:(OakTextView*)textView
{
for(auto const& item : bundles::query(bundles::kFieldSemanticClass, "callback.document.did-open", [textView scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false))
[textView performBundleItem:item];
}
- (void)openAndSelectDocument:(document::document_ptr const&)aDocument
{
document::document_ptr doc = aDocument;
@@ -1050,6 +1056,7 @@ namespace
{
[self makeTextViewFirstResponder:self];
[self setSelectedDocument:doc];
[self performSelector:@selector(didOpenDocuemntInTextView:) withObject:self.documentView.textView afterDelay:0];
}
else
{